Dependant TextInput

Hi ladies and gentlemen. I've been looking for the way y can give a TextInput field ('card_id-type') its value depending on the value of a Select field ('card_id). Both values belongs to the same owner. What i need is the TextInput field ('card_id-type') to take its value from its owner. How can i do this?
5 Replies
Matthew
Matthew4mo ago
Like in a form ?
Arko
Arko4mo ago
https://filamentphp.com/docs/3.x/forms/advanced#field-updates then use the $set as described to update your text inputs value
cmpDocs
cmpDocsOP4mo ago
Yes sr! The Select shows me the clients that are in the database, I select the 'card_id' of the relevant client, and the TextInput must be updated with the type of that 'card_id' This method doesn't consult the database to find out what type of document ('card_id_type') is associated with the selected 'card_id'.
Arko
Arko4mo ago
You can just query your database in the callback, or store all the data in a property on form initialisation and just grab it from that array. Multiple ways to go around it
cmpDocs
cmpDocsOP4mo ago
I'm actually very sorry to ask you this, but I wonder if you could please give me an example of how to do this with actual code. Please excuse me...!
Want results from more Discord servers?
Add your server