0
votes

In my form I have a input field with multiple checkboxes. This works as expected. When for some reason (eg an obligated field in the form is empty upon submit) the form after submit is not posted, all other fields maintain there input except the field below, all checkboxes become unchecked.

What can I do to make this field remember it's settings?

$options = array(
    '1' => 'one',
    '2' => 'two',
    '3' => 'three'    
);  

echo $this->Form->input('checkboxes',array(
'type' => 'select',
'multiple' => 'checkbox',
'options' => $options,
'default' => array(1,2,3)
));
1

1 Answers

0
votes

FormHelper uses the $this->request->data to fill the fields. You need to keep (or fill) your data in request data array and the cakephp will maintain your data.