Is there any way to define wich options in Zend_Form_Element_MultiSelect would be selected by default??
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
$element = new Zend_Form_Element_MultiCheckbox('foo', array(
'multiOptions' => array(
'foo' => 'Foo Option',
'bar' => 'Bar Option',
'baz' => 'Baz Option',
'bat' => 'Bat Option',
);
));
$element->setValue(array('bar', 'bat'));
http://framework.zend.com/manual/en/zend.form.standardElements.html#zend.form.standardElements.multiCheckbox