I am using zend framework and want to create a zend form where the user selects (using dropdowns) a country. Depending on the country, I would like the second ‘region’ dropdown to populate with the appropriate regions. Again, depending on the selected region, I would like a dropdown of cities to be populated. In each case, until the preceding values has been selected, I would like the next dropdown to be empty.
I am using doctrine2 and want these to be populated from the db.
What would be the best way to achieve this?
I don’t think there is any native way to achieve this using Zend framework. But you can use AJAX to send a request to the server when the user changes the option in the first select box and update the second select box with the results from the AJAX call.
For the server side code, http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/