-
On a form, I have two drop down selection lists. One is for State and the other is for City. I have a file that holds all the Cities per State. Once the user has selected a state, I would like to load the City list for all cities for the selected state. Can anyone give me some suggestions or examples. THANKS!
-
You can either do it on a refresh of the page using the onchange event for the state dropdown, or you can write all of your data into the page in a script tag using response.writes and a client side array. They put code in the onchange event of the state dropdown that repopulates the city dropdown based on elements of the array that match the criteria selected in the state dropdown.
Depends on what you consider the lesser of two evils:
A large page because lots of data is stored within it will take longer to download but once it is downloaded, is self sufficient to switch states and cities and requires no more round trips to the server (And presumably the database)
Refreshes will occurr quickly, but require another request to the server and another hit to the database. (You would pass back the selection in the state combo to the same page where it is used in the SQL statement to get the city data)