开发者

Multiple Zend Multicheckbox same name

开发者 https://www.devze.com 2023-03-31 11:45 出处:网络
I have a Zend_Form with multiple Multicheckbox element, the thing that I want is to give them all the same name: categories[].

I have a Zend_Form with multiple Multicheckbox element, the thing that I want is to give them all the same name: categories[]. When I add multiple elements like this:

 $this->createElement('multiCheckbox', 'categories[]')
    ->setLabel('Category 1')
    ->addMultiOption(1, 'Subcat1')

 $this->createElement('multiCheckbox', 'categories[]')
    ->setLabel('Category 2')
    ->addMultiOption(2, 'Subcat2')
    etc...

Only the Category 2 checkboxes are displayed.

Seems that Zend has the element name as leading. Currently I workaround this with different element names开发者_开发百科 but this isn't really workable at all.

How can I solve this?


that's not how you use multiCheckbox, use

$multicheckbox->addMultiOptions($zone);

see here a similar example addmultioption array problem in Zend


Ended splitting them up in separate groups.

0

精彩评论

暂无评论...
验证码 换一张
取 消