You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using a Filament Select to select data in a form.
The select is searchable() and the data is queried from an external API using getSearchResultsUsing() and getOptionLabelUsing()
I then save the value that the user selects, this all works fine.
If I then recall the page again, the select is prefilled with the value that the user selected.
I would like to show the label for that value from the API instead on initial page load.
How do I get the select to query the API again with the selected value and display the label from the result it returns?
I hoped preload() would do this, but it does not seem to preload the data from my getSearchResultsUsing() call.
Code: Select::make('accept_id') ->searchable() ->getSearchResultsUsing(fn(string $search): array => $this->getUsers($search)) ->getOptionLabelUsing(fn($value): ?string => $value),
getUsers() returns an array with all found users in the form of 'ID => formatted_name'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Package
Form builder
Package Version
v3.2.115
How can we help you?
I am using a Filament Select to select data in a form.
The select is searchable() and the data is queried from an external API using getSearchResultsUsing() and getOptionLabelUsing()
I then save the value that the user selects, this all works fine.
If I then recall the page again, the select is prefilled with the value that the user selected.
I would like to show the label for that value from the API instead on initial page load.
How do I get the select to query the API again with the selected value and display the label from the result it returns?
I hoped preload() would do this, but it does not seem to preload the data from my getSearchResultsUsing() call.
Code:
Select::make('accept_id') ->searchable() ->getSearchResultsUsing(fn(string $search): array => $this->getUsers($search)) ->getOptionLabelUsing(fn($value): ?string => $value),
getUsers() returns an array with all found users in the form of 'ID => formatted_name'
Beta Was this translation helpful? Give feedback.
All reactions