4

I need an array of check-box that should look like as following:

<input type="checkbox" name="myname[]" >

Currently I am using

new Zend_Form_Element_Checkbox('myname[]');

but it doesn't show the array in html control. It draw this as

<input type="checkbox" name="myname">

AnySolution?

1 Answer 1

2
<?php
$myname = new Zend_Form_Element_Checkbox('myname');
$myname->setLabel('This is my label')
       ->setRequired(true)
       ->addMultiOptions(array('myname' => true));
Sign up to request clarification or add additional context in comments.

5 Comments

Message: Method addMultiOptions does not exist
So i guess you wanted to use MultiCheckbox instead of normal Checkbox? But then you dont need to ->addMultiOptions. I have tried your example and it does print an error.
Maybe it doesn't work anymore due version change. It did work before.
method name is setMultiOptions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.