Studyon Minte9.com
ZF 1.0




Select multioptions validate



$element = new Zend_Form_Element_Select( $v );   
$element->setRequired(true);
$element->setRegisterInArrayValidator(false);
	// to avoid zend bug: 0 was not found in the haystack'
 
$validator=new Zend_Validate_GreaterThan(0);
$element->addValidator($validator);
	// without validator doesn't work
	//$element->addValidator(false);

$modelsApp = new models_AppAuto();
$counties = $modelsApp->getCounties();
$counties = array("0"=>"") + $counties; // don't use array_merge (resets keys) 
$element->addMultiOptions($counties);
$this->addElement($element);


http://stackoverflow.com/questions/11231870/zend-form-validation-value-was-not-found-in-the-haystack-error