I'm trying to alter a checked checkbox using hook_form_alter with this:
$form['foo']['#attributes'] = array();
$form['foo']['#default_value'] = '0';
Basically the current output of the form is this:
[foo] => array (
[#type] => [checkbox]
[#attributes] => array (
[checked] => [checked]
This is a checkbox that is checked by default. Now I want to uncheck the box and save it as that.
I managed to uncheck the box by default but that value does not save at all. Form is still being submitted with the checkbox checked.
What am I missing?