Iamcam posted a good hack on his blog. It makes your unchecked checkboxes show up in the $_POST on the server.
It’s very simple and doesn’t need javascript.
<input type="hidden" name="box1" value="0" />
<input type="checkbox" name="box1" value="1" />
If the checkbox is not checked then the value of the hidden input is submited, else the value of the checkbox.
observing:
$(’mycheckbox’).observe(’click’, function(e){alert(’checked = ‘ + this.checked);});
setting throught scripting:
$(’mycheckbox’).checked = true;
$(’mycheckbox’).setAttribute(’checked’, true);
$(’mycheckbox’).setValue(”); // will un-check/null value
$(’mycheckbox’).setValue(’anything’); // will check/on value
$(’mycheckbox’).click(); // will toggle the checkbox