/ Published in: PHP
On Zend Framework you can add options on Select Element on Form.php or Controller Action, and after you can disable it, on Form.php or Controller.php too.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Form.php $this->addElement( 'select', 'select_name', 'label' => 'Element Text Label:', 'required' => true, 'multiOptions' => array('value1' => 'text1', 'value2' => 'text2', 'value3' => 'text3', 'value4' => 'text4'), //'disable' => array('value2', 'value3') ); Controller.php //$selOptions = array('value1' => 'text1', 'value2' => 'text2', 'value3' => 'text3', 'value4' => 'text4'); //$form->getElement('select_name')->addMultiOptions($selOptions);