Cascading form is losing set value

I have a form that is using ->reactive() with ->options() where the options are set based on the value (Get $get['otherfield']) in another field. Basically there are three enjoined fields, where the prior field can potentially narrow the options in the latter fields. I am changing the options simply to make it easier to find the values in the second and third fields. It behaves similar to a Country->State->City type list, where initially the 'State' and 'City' fields include an exhaustive list, but when Country is selected, only states and cities in that country will be in each field and so on. (in my case they are Continent->Zone->Instance - it's a tool for Warcraft 'item needs') The problem occurs when the options list 'changes' when a value is set for one of the dependent fields. Even if the value for the dependent field exists in the reduced list of options, the set value disappears. This is a problem especially because the setting of the Continent triggers a change in the 'Zone' options, when loading an existing record, Continent will be set but Zone and Instance will not be set. How can I preserve the value set and then set the dependent fields if and when the option still exists in the reduced select list?
1 Reply
treii28
treii28OP2mo ago
Just clicking to 'edit' a record seems to work ok - all values are set and options lists are reduced accordingly. It's an issue because eventually I would like to go the other way as well (i.e. if you set 'instance' it will look up what zone and continent those are in and set those fields) so a user can either narrow down the list first-to-third select list, or can go through the long list in the third field to set all three simultaneously. As soon as the state of Continent changes, it replaces the options in 'zones' which loses it's value even if the already-set zone was in the new reduces option list. That then triggers a change in instance near as i can tell again losing it's value.
Want results from more Discord servers?
Add your server