F
Filament6mo ago
zemo

Is there a way to get the selected label instead of the selected value?

I have a select that displays a list of cities, which will store the city_id. In another input, I need to get the city name, not its id. The Get $get utility will retrieve the value, not the label. Is there accomplish this, aside from doing an additional query?
Solution:
Not really. Even with plain Livewire you'd need to work around this, since the select only transmits it's value not the label.
Jump to solution
5 Replies
toeknee
toeknee6mo ago
Nope... can you translate the value?
zemo
zemoOP6mo ago
by translate you mean do an additional query, right? yes, I will do that if it's the only possibility
Solution
Dennis Koch
Dennis Koch6mo ago
Not really. Even with plain Livewire you'd need to work around this, since the select only transmits it's value not the label.
Dennis Koch
Dennis Koch6mo ago
Hacky idea: Join ID and Label for the value, then split it up again in a ->afterStateUpdated()
zemo
zemoOP6mo ago
thanks to both!! marking as solved
Want results from more Discord servers?
Add your server