How to put space in between option value of Zend_Form_Element_Select
Expected result as follows,
http://jsfiddle.net/HLbQE/
Tried as follows,
$this->addElement('Select', 'parent_id', array(
'label' => 'Select Category',
'multiOptions' => array('0'=>'Gents','1'=>' &am开发者_如何学编程p;nbsp;Jeans','2'=>' Sunglass','3'=>'Ladies','4'=>' Jeans','5'=>' Sunglass')
));
but fails,
Any help please
Why not just use optgroups? ZF handles this natively by using a nested array for the multi-options, eg
$options = array(
'Gents' => array(
1 => 'Jeans',
2 => 'Sunglass'
),
'Ladies' => array(
3 => 'Jeans',
4 => 'Sunglass'
)
);
Updated demo here - http://jsfiddle.net/HLbQE/1/
Try this:
$this->addElement('Select', 'parent_id', array(
'label' => 'Select Category',
'multiOptions' => array('0'=>'Gents','1'=>' Jeans','2'=>' Sunglass','3'=>'Ladies','4'=>' Jeans','5'=>' Sunglass'),
'escape' => false // <-- added
));
I seems this will not work indeed, as reported in this, still unresolved, issue:
http://framework.zend.com/issues/browse/ZF-5351
精彩评论