gpt4 book ai didi

zend-form - 在 Zend Form 中装饰单选按钮

转载 作者:行者123 更新时间:2023-12-04 06:30:23 26 4
gpt4 key购买 nike

我有一个来自数据库的单选按钮列表。我想把它们每个都放在一个单独的“td”中。我所做的是:

foreach ($notificationTypes as $key => $value) {
$radios->removeDecorator('DtDdWrapper');
$radios->removeDecorator('HtmlTag');
$radios->addMultiOption($value, $value . "_" . $i);

}
$radios->setDecorators($this->elementDecorators);
$this->addElement($radios);

这是我的装饰者:
abstract class Myprj_Form_Abstract extends Zend_Form {

protected $elementDecorators = array(
'ViewHelper',
'Errors',
array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'right_columns')),
array('Label', array('tag' => 'td')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
);
}

但是,我得到的是,所有单选按钮都位于一个 td 中。我知道我可以在 View 中执行它,但我想将它们执行到表单中。有人知道怎么做吗?

非常感谢

最佳答案

我找到了答案,所以我要分享它......

我只需要添加

$radios->setSeperator('</td></tr><tr><td>');

容易,嗯?

干杯,

关于zend-form - 在 Zend Form 中装饰单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5496065/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com