如何设置 zend multiCheckbox 表单字段并选中复选框?
我有这种形式:
$this->addElement (
'multiCheckbox', 'servers2',
array (
'checkedValue' => '0',
'multiOptions' => array(
'11.com' => '.com',
'12.com' => '12.com',
'16.com' => '16.com',
'3.com' => '17.com'
)
));
问题是 checkedValue
不适用于此设置,它适用于简单的复选框。我也尝试过 'checkedValues' => array('1','0')
,单数或复数, 但看不到尽头。
有什么想法吗?
谢谢
i have this form:
$this->addElement (
'multiCheckbox', 'servers2',
array (
'checkedValue' => '0',
'multiOptions' => array(
'11.com' => '.com',
'12.com' => '12.com',
'16.com' => '16.com',
'3.com' => '17.com'
)
));
the problem is that the checkedValue
doesn't work for this setup, it does for a simple checkbox. I've also tried 'checkedValues' => array('1','0')
, singular or plural,
but no end in sight.
any ideas?
THanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要将某些复选框标记为已选中,请尝试以下操作:
另请参阅 Zend_Form_Element_MultiCheckbox
To mark certain checkboxes as checked, try this:
See also Zend_Form_Element_MultiCheckbox
ZF2将要求您使用value_options;
ZF2 will require you to use value_options;
要指定选中的选项,请参见 at< /a>
使用
'selected' =>; true
属性:To specify the checked options, as seen at
use the
'selected' => true
attribute: