FilamentF
Filament2y ago
21 replies
nowak

TextInput live onBlur does not seem to work as expected

I have this test and name field in my form:
Forms\Components\TextInput::make('test')
  ->maxLength(255),
              
Forms\Components\TextInput::make('name')
  ->required()
  ->maxLength(255)
  ->live(onBlur: true)
  ->afterStateUpdated(function ($state, Set $set) {
  $set('test', $state);
}),

Where I expect the name field to only trigger the afterStateUpdated() method when I leave the field, but I am experiencing that the live update is happening while the name field is still focused. Is this the expected behaviour?

I have attached a screen recording of the behaviour explaining the issue.
Solution
I had to refresh the page, then live(onBlur: true) works as expected.
Was this page helpful?