Multi-column checkboxes radios

Drupal Modules - Thu, 02/07/2009 - 8:52pm
multicolumn.png

Add '#multicolumn' property to the form element checkboxes and radios to make checkboxes and radios display in columns.

Usage

In the definition of form element checkboxes/radios, add the '#multicolumn' property:

<?php
$form['my_checkboxes'] = array(
'#type' => 'checkboxes',
'#multicolumn' => array('width' => 3, 'minimum height' => 10),
   .
   .
   .
);
$form['my_radios'] = array(
'#type' => 'checkboxes',
'#multicolumn' => array('width' => 5),
   .
   .
   .
);
?>

The 'width' parameter is required, the 'minimum height' parameter is optional and it's used to keep column from looking "short/flat" and using fewer columns to keep column to the specified height.

See README.txt on how to override css to adjust different column width.