checkboxes_value

Definition

checkboxes_value(&$form)
includes/form.inc, line 1239

Description

Helper function to load value from default value for checkboxes.

Related topics

Namesort iconDescription
Form generationFunctions to enable the processing and display of HTML forms.

Code

<?php
function checkboxes_value(&$form) {
  $value = array();
  foreach ((array)$form['#default_value'] as $key) {
    $value[$key] = 1;
  }
  $form['#value'] = $value;
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.