Barry Hamilton
Barry Hamilton

Reputation: 973

zend add checkbox to multi checkbox

I'm looking to do the equivalent of

    $element->addMultiOption('value', 'text');

which works for multi select dropdowns.

I can't seem to figure the equivalent is fro multi checkboxes.

Upvotes: 1

Views: 896

Answers (2)

Barry Hamilton
Barry Hamilton

Reputation: 973

Their is no difference between

 $element->addMultiOption('value', 'text');

For multiCheckbox elements and multiselect elements. Error was cause elsewhere

Upvotes: 1

Ehecatl
Ehecatl

Reputation: 122

try something like this:

$multichekboxElement = new Zend_Form_Element_MultiCheckbox("name_for_your_multicheckbox");
$multicheckboxElement->addMultiOption(1,'text-1');
$multicheckboxElement->addMultiOption(2,'text-2');
$multicheckboxElement->addMultiOption(3,'text-3');
$multicheckboxElement->addMultiOption(4,'text-4');

Then you just have to add the *"multicheckboxElement" variable to your Form as normal.

Upvotes: 1

Related Questions