March 2nd, 2009Zend Form and an ajax select box
I created a form with Zend_Form adding 2 select boxes. One where all the states would be shown and after selecting a state, it had to update a second select box with all the cities corresponding to the chosen state.
After I had build the form, I created the javascript code (JQuery) to get all the cities corresponding to the selected value of the states select box.
Now when I tried to submit the form, the validation on the form failed.
This was because Zend_Form automatically validates the submited values with the original values added to the select boxes.
Solution:
//cities is our select box created with Zend_Form_Element_Select
$cities->setRegisterInArrayValidator(false);
The validation on the select box ‘cities’ is turned off and you will be able to submit the form.
No Tags




May 22nd, 2009 at 8:12 pm
Better solution is to put all posibble cities to the Zend_Form_Element, and filter them out using jQuery.
May 29th, 2009 at 7:47 pm
Can you please share the files which you have created? I have tried searching through out the internet but not able to find the sample like this.
February 1st, 2010 at 3:18 pm
plz share the files