TagsInput : Suggestions list

Hi, is there a way to reset the suggestions list of TagsInput field ? i've a case when changing a select field i should change the the suggestions list here's my code : Select::make('model') ->options(['model1' => 'model1', 'model2' => 'model2']) ->afterStateUpdated(fn ($set) => $set('ids', [])) ->reactive() ->required(), Forms\Components\TagsInput::make('ids') ->suggestions( function ($state, $get) { if ($get('model')) { return app()->make("App\Models\\" . $get('model'))::pluck('name', 'id'); } else return $state; } ) ->required(),
4 Replies
Dan Harrin
Dan Harrin2y ago
that should work as you have it the view is reloaded when the select changes as it is reactive()
Mambi
MambiOP2y ago
@Dan Harrin what i want to do is to change the suggestions list depending on the selected option (from the select field), this code works but reset only the list of tags not the suggestions list
Dan Harrin
Dan Harrin2y ago
does the suggestions() function get run when the select changes
Mambi
MambiOP2y ago
it's working now, i think it was a cache problem thanks for your time
Want results from more Discord servers?
Add your server