The problem i had was that my custom validator was not being called when the value of the input (select) was empty. I couldnt use setRequired() because in some cases (dependent upon another form value) i want to process empty values. The solution was to do the following:
$organiser_member = new Zend_Form_Element_Text(’organiser_member’); $organiser_member->setLabel(’* Organiser:’); // Force empty values through the custom validator! $organiser_member->setRequired(false); $organiser_member->setAllowEmpty(false); // Add the custom validator $organiser_member->addPrefixPath(’BC_Validate’, ‘BC/Validate’, ‘validate’); $organiser_member->addValidator(’EventOrganiser’, false); $form->addElement($organiser_member); Now the custom validator is always called, whether the input ‘organiser_member’ is set or not. -- View this message in context: http://www.nabble.com/Custom-validator-not-run-when-a-Zend_Form-field-is-empty--tp23666798p25874140.html Sent from the Zend Framework mailing list archive at Nabble.com.
