如何以zend形式设置装饰器?
我正在使用 zend。我正在尝试为以下 div 结构设置装饰器,
<div class="fm">
<div class="fm_text">
<div class="p_details">Debit Weight:</div>
</div>
<div class="fm_text">
<div class="txtbox">
<input type="text" name="pname" class="txtcolor">
</div>
</div>
<div class="fm_text">
<div class="p_details">Credit Weight:</div>
</div>
<div class="fm_text">
<div class="txtbox">
<input type="text" name="pname" class="txtcolor">
</div>
</div>
</div>
<div class="fm">
......
</div>
为上述 div 结构设置装饰器很困难。我尝试使用以下代码,
public $requirednewElementDecorators = array(
'ViewHelper',
'Errors',
array('Description', array('escape' => false, 'tag' => 'span', 'class' => '', 'placement' => 'prepend')),
array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'fm_text')),
array('Label', array('tag' => 'div', 'class' => 'p_details')
),
array('HtmlTag', array('tag' => 'div', 'class' => 'fm'))
);
我必须使用 zend 表单,以便我可以有效地验证表单。我可以在模板中使用 HTML 并继续流程。但我不想那样做。请帮助我。
I am using zend. I am trying to set decorators for the following div structure ,
<div class="fm">
<div class="fm_text">
<div class="p_details">Debit Weight:</div>
</div>
<div class="fm_text">
<div class="txtbox">
<input type="text" name="pname" class="txtcolor">
</div>
</div>
<div class="fm_text">
<div class="p_details">Credit Weight:</div>
</div>
<div class="fm_text">
<div class="txtbox">
<input type="text" name="pname" class="txtcolor">
</div>
</div>
</div>
<div class="fm">
......
</div>
It is difficult to set decorator for above div structure.I tried with following code ,
public $requirednewElementDecorators = array(
'ViewHelper',
'Errors',
array('Description', array('escape' => false, 'tag' => 'span', 'class' => '', 'placement' => 'prepend')),
array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'fm_text')),
array('Label', array('tag' => 'div', 'class' => 'p_details')
),
array('HtmlTag', array('tag' => 'div', 'class' => 'fm'))
);
I have to use zend form so that i can validate form effectively. I can use the HTML in template and continue the flow. but i dont want to do that.Kindly help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两个输入字段在一起?您可以使用
的字段集进行尝试。因此,您必须使用 fieldset 装饰器。为什么您不想使用
而不是
Debit Weight:< /div>
?这篇文章非常有帮助,也许: http://devzone.zend.com/article /3450-Decorators-with-Zend_Form
Two input-fields togehter? You can try it with a fieldset for the
<div class="fm">...</div>
. So, you must use the fieldset decorator. Why do you not want to use the<label class="p_details">DebitWeight</label>
instead of<div class="p_details">Debit Weight:</div>
?This article is very helpful, maybe: http://devzone.zend.com/article/3450-Decorators-with-Zend_Form