© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
17 replies
Bagus A

Create Slug Automatically on Text Input Not Working Properly

Here I create a slug automatically based on name input. I use the same code as the docs https://filamentphp.com/docs/3.x/forms/advanced#generating-a-slug-from-a-title

From the video I attached, you can see that whenever slug is updated it got the name field somehow got reset. I'm not sure if there's a settings I should do because in version 2 using reactive, it was working properly.

I'm trying to write Spongebob on the video.

Thank you for all the help.

       Forms\Components\TextInput::make('name')
                    ->live()
                    ->afterStateUpdated(fn (Set $set, ?string $state) => $set('slug', Str::slug($state)))
                    ->required()
                    ->maxLength(255),
                Forms\Components\TextInput::make('slug')
                    ->required()
                    ->maxLength(255),
       Forms\Components\TextInput::make('name')
                    ->live()
                    ->afterStateUpdated(fn (Set $set, ?string $state) => $set('slug', Str::slug($state)))
                    ->required()
                    ->maxLength(255),
                Forms\Components\TextInput::make('slug')
                    ->required()
                    ->maxLength(255),
Advanced forms - Form Builder - Filament
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Automatically hint on text input
FilamentFFilament / ❓┊help
3y ago
Text Input Column Validation Not Working
FilamentFFilament / ❓┊help
2y ago
text input field update based on another text input
FilamentFFilament / ❓┊help
2y ago
Making slug from 2 input
FilamentFFilament / ❓┊help
3y ago