脚本宝典收集整理的这篇文章主要介绍了zend-framework – Zend Form,表装饰器,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<table> <thead><tr><th>one</th><th>two</th><th>three</th><th>four</th></thead> <tbody> <tr> <td><input tyPE='checkBox' id='something'/></td> <td><img src='src'/></td> <td><input type='text' id='something'/></td> <td><input type='radio' group='justonegroup'/></td> </tr> <tr> <td><input type='checkBox' id='something'/></td> <td><img src='src'/></td> <td><input type='text' id='something'/></td> <td><input type='radio' group='justonegroup'/></td> </tr> </tbody> </table>
正文中的行数由我的表单类中的循环结构决定.当然,所有ID都是独一无二的.表单中的所有单选按钮属于一个组.我的问题是我不确定如何创建然后在我的表中设置Zend_Form_Element_MultiCheckBox和Zend_Form_Element_Radio对象的样式.在哪里/如何将相应的装饰器应用于复选框和单选按钮以获得如上所述的表单结构?
到目前为止我的Form类:
class Form_ManageAlbums extends Zend_Form { public function __construct($album_id) { $photos = Model_DBTable_Photos::getAlbumPhotos($album_id); $selector = new Zend_Form_Element_MultiCheckBox('selector'); $radio = new Zend_Form_Element_Radio('group'); $options = array(); while($photo = $photos->fetchObject()) { $options[$photo->id] = ''; $image = new Zend_Form_Element_Image('image'.$photo->id); $image->setImageValue('/dog/upload/'.$photo->uid.'/photo/'.$photo->src); $caption = new Zend_Form_Element_Text('caption'.$photo->id); $caption->setValue($photo->caption); $this->addElements(array($image,$caption)); } $selector->addMultiOptions($options); $radio->addMultiOptions($options); $this->addElement($selector); $this->setDecorators(array( 'FormElements',array('HtMLTag',array('tag' => 'table')),'Form' )); } }
我为td和tr尝试了一些装饰器的组合,但迄今为止没有成功.
感谢您的帮助,非常感谢.
JP Levac
以上是脚本宝典为你收集整理的zend-framework – Zend Form,表装饰器全部内容,希望文章能够帮你解决zend-framework – Zend Form,表装饰器所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。