I've got this form element:
$form->input('ChecklistResponseGovernmentInfo.driversLicenseIsOnline', array('type'=>'radio', 'empty'=> true, 'options'=>array(0 => 'No', 1 => 'Yes')))
This is the validation rule for it:
'driversLicenseIsOnline' => array(
'boolean' => array(
'rule' => array('boolean'),
'allowEmpty' => false,
),
),
And this is the database field for it (MySQL):
`driversLicenseIsOnline` tinyint(1) unsigned NOT NULL
When I first load a fresh copy of my form, the radio button set is unselected. If I submit the form without doing anything else, when the form reloads, the radio button is filled in as "No" and the validation flash message says "This field cannot be left blank".
The problem goes away when I stop using zero (0) as the value for "No", but I want Cake to store this value as a boolean, not as some other value that I would have to manually translate back and forth to boolean.
How do I stop Cake from automatically filling in a value for this element when it's submitted with no radio selected?