Select dependant from TextInput
Hello,
I'm trying to build a zipcode search inside a form.
The user enters the zipcode manually in the text field then the select updates with only the corresponding cities. Tried to follow the various examples for dependant selects but maybe there's a better way with v3?
12 Replies
->searchable()
Thanks, ->searchable() works fine for the select but I have to reproduce the functionality where the user types the zipcode in text field.
Guess I’m missing the point. Sorry. Searchable finds the record and assigns its id to the field.
There's a strange thing happening with ->searchable, when you browse the fields with tab key and you arrive to the select it writes the last key you pressed in the select list.
It's also happening with the demo.
If it’s happening in the demo then it’s a bug.
But you should still be able to do what you’re after with the link I provided, regardless of the bug.
I'm trying, thank you.
Totally missed this one sorry. You’ll also need to look into dependent fields and reactivity. https://filamentphp.com/docs/3.x/forms/advanced
https://filamentphp.com/docs/3.x/forms/advanced#dependant-select-options
I'm close to something. It's working but I need the first value to be displayed in the select, now I have to click to see all the values.
Sorry, I want to help more but I’m brain dead right now. Working on something really difficult all day, trying to do the impossible.
No problem, your help was already precious.
Maybe I have to use ->afterStateUpdated with the TextInput, is it possible to set the select options with?