Patrioticcow
Patrioticcow

Reputation: 27038

how to create a checkbox group in zend framework 2

i am trying to create a checkbox group, something like:

Checkbox Label
|_| Checkbox1
|_| Checkbox2
...

i found this code that renders one checkbox only

$this->add(array(
        'name' => 'checkbox',
        'type' => 'Zend\Form\Element\Checkbox',
        'options' => array(
            'label' => 'A checkbox ',
            'checked_value' => 'good',
            'unchecked_value' => 'bad',

        )
    ));

any ideas? thanks

Upvotes: 1

Views: 8939

Answers (2)

Denis Ryabov
Denis Ryabov

Reputation: 1350

There is article with full example of multicheckbox processing (including storing/reading in DB):

Zend Framework 2 : Extending Zend\Form to add Select, Multicheckbox, Email,Date, Textarea, and Radio element

Upvotes: 2

Related Questions