Why Select multiple & TagsInput afterStateUpdated() not triggering
- I'm trying to wire:model.blur my users field using Select()->multiple()->options([])->live(onBlur: true)->afterStateUpdated().
- I tried live(onBlur: true)->afterStateUpdated() using other input like TextInput, Select (single option), Radio. And those inputs work just fine.
- Example of working code (using TextInput):
when I un-focus the name field, it will run the afterStateUpdated method and save the updated data in db.
- NOT WORKING:
afterStateUpdated method not even triggered, when I select/deselect. Nothing seems to work.
Any suggestions?
7 Replies
Or maybe currently Filament just doesn't support wire:model.blur
use
live()
I have similar issue ,i have used live()
What issue? Could you share the code please?
please share the code
the Solution @Leandro Ferreira suggested did the trick. the the code is Select::make('users')
->label('Users:')
->multiple()
->options([
'test1' => 'Test One',
'test2' => 'Test Two',
'test3' => 'Test Three'
])
->searchable()
->live()
->afterStateUpdated(function (Model $record, $state) {
$record->update(['users' => $state]);
}),
sometimes it is good to clear the cache php artisan cache:clear
Did you solve this issue ?