This module provides an extension to the builtin checkboxes element that allows developers add "check all" / "toggle" / "uncheck all" actions to them. This is specially useful for checkboxes that have a lot of elements.
Please note that Drupal 6 already has this feature available, but only for checkboxes rendered in tables, such as those used in Administration -> Content management -> Content. Checkboxes rendered elsewhere do not have this feature.
You may need to install this module when required/recommended by another contributed module, and/or you may wish to use it to enhance your own custom modules.
-
For Site Administrators - New option for checkboxes implemented by CCK Widgets
If you use checkboxes implemented by CCK optionwidgets, node reference, user reference or content taxonomy options, then a new option in the field settings form is available to enable the Checkall feature for those widgets.
-
For Developers - Simple Usage
To attach the checkall behavior to checkboxes elements, all you need to do is add the '#checkall' property to them. You can do so for your own forms, or you can implement hook_alter_form() to add this property to existing forms. Example:
$form['foobar'] = array(
'#type' => 'checkboxes',
'#options' => $options,
'#default_value' => $default_value,
'#checkall' => TRUE, // <--- this is it ;-)
);