function webform_checkbox_value in Webform 6.3
Helper function to determine the value for a checkbox form element.
Drupal core cannot decern the difference between an unchecked checkbox and a checked checkbox that has a value of '0'. This value callback will return NULL instead of an integer 0 for checkboxes that are not checked.
See also
1 string reference to 'webform_checkbox_value'
- webform_expand_checkboxes in components/
select.inc - Drupal 6 hack that properly *renders* checkboxes in multistep forms. This is different than the value hack needed in Drupal 5, which is no longer needed.
File
- components/
select.inc, line 488 - Webform module multiple select component.
Code
function webform_checkbox_value($form, $edit = FALSE) {
if ($edit !== FALSE) {
if (empty($form['#disabled'])) {
return $edit !== NULL ? $form['#return_value'] : NULL;
// 0 in core.
}
else {
return $form['#default_value'];
}
}
}