Multiple Zend Multicheckbox same name
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.
精彩评论