selection - Zend Framework: select element - how to set required? -
how set status "required" zend_form_element_select when has value "0"?
$country = new zend_form_element_select('wbm_country'); $country->setlabel('select:') ->setrequired(true) ->addmultioptions(array(0 => ' ----------- ') + $this->_countries_select);
when wbm_country 0 doesn't show error @ all.:(
if want 0 give error can use
$required = new zend_validate_notempty (); $required->settype ($required->gettype() | zend_validate_notempty::integer | zend_validate_notempty::zero); $country = new zend_form_element_select('wbm_country'); $country->setlabel('select:') ->addvalidators (array ($required)) ->addmultioptions(array(0 => ' ----------- ') + $this->_countries_select);
Comments
Post a Comment