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

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -