I have this line of code:
echo $form->input('type', array('label' => 'Phase', 'type' => 'select', 'multiple' => 'checkbox', 'options' => $types, 'selected' => $inst_type, 'empty' => 'All'));
Now when 'selected' param is emp开发者_如何学Pythonty the checkbox created by the 'empty' param is checked. How can I prevent this?
Thanks in advance
you should not use "selected". simply use $this->data to prefill the form data - and only if $inst_type is not empty
so in the controller in the else block of !empty($this->data):
$this->data['Model']['field'] = $inst_type
精彩评论