ZF-9329: Support for disable attribute in Zend_Form_Element_Select
Description
Same behavior as in Zend_Form_Element_Checkbox.
Add before element in form one input with type="hidden" and value of disabled select.
Same behavior as in Zend_Form_Element_Checkbox.
Add before element in form one input with type="hidden" and value of disabled select.
Comments
Posted by Lukas Drbal (lestr) on 2010-03-04T07:41:26.000+0000
My patch for view helper. Multiple values are not supported
Posted by Lukas Drbal (lestr) on 2010-03-04T08:26:13.000+0000
Better solution and add unittest for this patch
Posted by Derek Stephen McLean (delboy1978uk) on 2011-04-25T23:00:53.000+0000
I got this working without any problems! (so long as your disabled option has no value set.)
$this->_select->addMultiOption('','Please Select...'); //default select option with no value $this->_select->setAttrib('disable',array('')); //set disable on option with value of '' $this->_select->setRequired(true); //make sure user picks something!
then add the other enabled options :-)
$this->_select->addMultiOption($row->value,$row->name); //options to select
hope this helps :-)