这是我生成select元素的代码:
$configsForm->addElement(
'select',
'option_status',
array(
'label' => $this-> view -> __('Configs_Option Status'),
'required' => true,
'value' => '',
'multiOptions' => array('' => $this -> view -> __('Root'), 0 => 'Disabel', 1 => 'Enabel'),
)
);
生成的选择就像这样
<select name="configs[option_status]" id="configs-option_status" required="1">
<optgroup id="configs-option_status-optgroup-options" label="options">
<option value="" label="Select option" selected="selected">Select option</option>
<option value="0" label="Disabel">Disabel</option>
<option value="1" label="Enabel">Enabel</option>
</optgroup>
<option value="listsep" label="<br />"><br /></option>
<option value="id" label="configs-option_status">configs-option_status</option>
</select>
应该是这样的
<select name="configs[option_status]" id="configs-option_status" required="1">
<option value="" label="Select option" selected="selected">Select option</option>
<option value="0" label="Disabel">Disabel</option>
<option value="1" label="Enabel">Enabel</option>
</select>
这怎么渲染?
答案 0 :(得分:0)
您确实设置了两个选项('Disabel'和'Enabel'),但您还设置了另一个选项:$this->view->__('Root')
。你确定这只会返回"Select Option"
吗?
您可以执行Zend_Debug::dump($this->view->__('Root'))
并显示输出结果吗?我认为这将有助于您解决问题。