I am a newbie to Zend Framework and I am trying to making a Form using Zend Form. In that Form I want cascading drop downs of country, state and city. I have filled country’s drop down from database but I have no idea how do I fill state’s drop down by getting the country id.
Thanks in advance.
To dynamically load countries you should use it the way you did:
And here is nothing to do with
Zend_Form. You should have aJSONservice (for e.g.) that will acceptCountryIDand will return all states available.For this purpose you should connect
jQuerylibrary in your<head>section.Add you
jQueryscript to yourtemplatewhich will handle all events like this:or
And here you are, nothing to do with
Zend_Fromexcept assigning correct elementsID‘s,classesornames.And for your
serviceyou can do smth. similar. Suppose URLhttp://localhost/mysite/service/states/country/ATand … welcome