I have multiple checkboxes in CakePHP\'s Add/Edit view, created with:
echo $this->Form->input(\'email_warning_chb\', array(\'type\'=>\'select\', \'m
this looks like this one
cakephp: How to set checkbox to checked?
where $selected
contains the selected values
in your controller you have to put the value like this:
$this->request->data['Model']['email_warning_chb'] = array(5,15,60);
and it will automatically display checkbox as selected.
Please ask if not work for you.
As said in other answers, you should set the 'selected' option. What some people don't mention is that your selected array should only contain the id in each element. Example:
$selectedWarnings = $this->Warning->find('list', array(
'fields' => array('id')
));
echo $this->Form->input('email_warning_chb', array(
'label' => 'Email Notice',
'type' => 'select',
'multiple' => 'checkbox',
'options' => $warnings,
'selected' => $selectedWarnings
));