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.
2 Replies
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.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!