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),
Was this page helpful?