【发布时间】:2011-06-20 10:34:43
【问题描述】:
你好,我正在尝试做一个复选框显示:
<input name="choice2" id="choice2" value="1" type="checkbox">
<label for="choice2" class="optional">Credit Card</label><br />
Some text
<input name="choice2" id="choice2" value="1" type="checkbox">
<label for="choice2" class="optional">Credit Card</label><br />
Some text
我非常接近以下代码:
$lbl_spagym = 'Credit Card<br />
<p class="description">Some text</p><br />';
$chk_spagym = new Zend_Form_Element_Checkbox('chk_spagym');
$chk_spagym->setLabel($lbl_spagym)
->setDecorators(array(
'ViewHelper',
'Description',
'Errors',
array('Label', array('placement' => 'APPEND', 'escape' => false)),
array('HtmlTag', array('tag' => 'div'))
));
它呈现为:
<div>
<input type="hidden" name="chk_bank" value="0" />
<input type="checkbox" name="chk_bank" id="chk_bank" value="1" checked="checked" />
<label for="chk_bank" class="optional">Credit Card<br />
<p class="relocation_descr">Some text</p><br />
</label></div>
但我需要将<p></p> 排除在标签标签之外,因为“某些文本”是描述而不是标签。我玩了几天的装饰器,但无法正确处理这种行为。在此感谢任何 cmets。
【问题讨论】:
标签: zend-framework checkbox zend-form