I am using form edit. There are two select boxes in the form. One select box is the country, another select box is the state. The state select box depends on the country selected and will be populated dynamically. For example:
Country:
US (option value=1)
UK (option value=2)
State for US:
Alabama (option value=1)
California (option value=2)
Florida (option value=3)
Hawaii (option value=4)
State for UK:
London (option value=5)
Oxford (option value=6)
As you can see above the id of state for uk starts with 5. When I edit a record which contained Country id=2 (UK) and State id=6 (Oxford), the edit form will shows correctly – Country is UK and State is Oxford. But if you drop down the state select box the option text is correct (it shows London Oxford) but the option value will starts from 0. What should be correct is that the option value should starts from 5.
If you select and change the country drop down box to US then change back again to UK, the option value will be populated correct (starts from 5).
My question is, how can we populate the select box for the state with the correct option value based on the country in edit box when the edit form loads?
Thanks.
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top