You are here

function webform_expand_checkboxes in Webform 5.2

Same name and namespace in other branches
  1. 6.3 components/select.inc \webform_expand_checkboxes()
  2. 6.2 components/select.inc \webform_expand_checkboxes()

Drupal 5 hack that properly sets checkbox values in multistep forms. The checkboxes element get the proper values set by FAPI, but individual checkboxes are always set to 0 in a multistep form.

File

components/select.inc, line 201
Webform module multiple select component.

Code

function webform_expand_checkboxes($element) {
  $element = expand_checkboxes($element);
  foreach (element_children($element) as $key) {
    if (empty($element['#value'][$key])) {
      $element[$key]['#value'] = 0;
    }
    else {
      $element[$key]['#value'] = 1;
    }
  }
  return $element;
}