使用这段代码
$feOnline = New Zend_Form_Element_Radio('online');
$feOnline->setValue($article->online)
->addMultiOptions(array(0=>'offline', 1=>'online'))
->setLabel('Online');此html是生成的
<dd id="online-element">
<label for="online-0">
<input type="radio" checked="checked" value="0" id="online-0" name="online">offline
</label><br>
<label for="online-1"><input type="radio" value="1" id="online-1" name="online">online
</label>
</dd>但是,我不希望在label-tag中使用input-tag。不需要“
“都不是...
我必须添加哪些装饰器才能获得此输出?
<dd id="online-element">
<input type="radio" checked="checked" value="0" id="online-0" name="online"><label for="online-0">offline</label>
<input type="radio" value="1" id="online-1" name="online"><label for="online-1">online</label>
</dd>发布于 2010-05-03 20:47:35
如果你使用的是默认的Zend_View_Helper_FormRadio,你不能改变渲染无线电的方式。
代码如下(第159行)
// Wrap the radios in labels
$radio = '<label'
. $this->_htmlAttribs($label_attribs) . ' for="' . $optId . '">'
. (('prepend' == $labelPlacement) ? $opt_label : '')
. '<input type="' . $this->_inputType . '"'
. ' name="' . $name . '"'
. ' id="' . $optId . '"'
. ' value="' . $this->view->escape($opt_value) . '"'
. $checked
. $disabled
. $this->_htmlAttribs($attribs)
. $endTag
. (('append' == $labelPlacement) ? $opt_label : '')
. '</label>';没有用于更改逻辑的配置。想一想为什么你真的需要改变它的呈现方式,例如,尝试使用CSS来设置输出的样式。
如果得出结论,您需要更改呈现方式,创建自己的视图帮助器,并使用它来代替默认的帮助器。
https://stackoverflow.com/questions/2743151
复制相似问题