F
Filament10mo ago
Jim

Clearing a searchable select's search value if no results are returned

Hi, I'm wondering if there's a simple way to clear the search query of a select box when no results are returned from the search. I've managed to succesfully trigger code based on the search results but I can't find out if its possible to clear the input value. Using set() or fillform to clear the input will as expected clear any selected values, but not the search input. Sorry if this is a stupid question, Thanks.
No description
2 Replies
Dennis Koch
Dennis Koch9mo ago
Using set() or fillform to clear the input will as expected clear any selected values, but not the search input.
Hm, maybe that's not possible. I think getSearchResults($search) is the first call and that one comes directly from JS side. So you cannot reset that state in a Livewire component or similar.
Jim
JimOP9mo ago
Fair enough, the use case for this was a scanner where if the input returned no results (i.e an incorrect barcode was scanned) the input should be cleared, for now I've reverted to a textinput/datalist with notifications and some wonky JS injected in to get the input to work how I want. Thanks for the reply none the less!
Want results from more Discord servers?
Add your server