Display checkboxes and radios in columns in CCK, webform or FAPI elements.
Usage
CCK: Multicolumn option settings is in the field configuration screen of field types text, nodereference, userreference, content taxonomy and Select or other if they use the check boxes/radio buttons widget. See README.txt on how to add additional CCK widget type support. If you find any other CCK widget type can be supported, please report in issue queue so they can be added.
Webform: See #946956: Implement alter() hook to allow external module to extend existing components?
Form API: in the definition of checkboxes/radios form element, add the '#multicolumn' property to the checkboxes or radio buttons form element definition:
<?php
$form['my_checkboxes'] = array(
'#type' => 'checkboxes',
'#multicolumn' => array('width' => 3),
.
.
.
);
$form['my_radios'] = array(
'#type' => 'radios',
'#multicolumn' => array('width' => 5,
'row-major' => TRUE,
'indent' => 3,
'caption' => t('December'),
'column-heading' => array(t('Mon'), t('Tue'), t('Wed'), t('Thu'),
t('Fri'), t('Sat'), t('Sun')),
'row-heading' => array(t('Week 1'), t('Week 2'), t('Week 3'))
),
.
.
.
);
?>Parameters:
- 'width' integer, required
- specifies the number of columns to display the checkboxes/radios.
- 'row-major' boolean, optional
- set to TRUE to change display across first, then down. The default is column-major: down first, then across.
- 'indent' integer, optional
- Number of columns in column major or rows in row major to indent
- 'caption' string, optional
- Caption center above the columns
- 'column-heading' array, optional
- Column heading
- 'row-heading' array, optional
- Row heading
Note: the checkall module is very handy for lots checkboxes.
Note to module writers: you can add multi-column settings to your checkboxes/radios without dependency to this module. For sites that have this module enable, your checkboxes and radios will be in muti-column. For sites without, the checkboxes and radios will just display in single column.
How to adjust column width: each column is inside a <td> with class "multicolumncheckboxesradios-column", define override css rule
... .multicolumncheckboxesradios-column {
width: nnn;
}to change column width. See README.txt for complete details on the markup.
See a demo at: http://zen.hddigitalworks.com/multicolumn-checkboxes-radios
Downloads
Recommended releases
Development releases
Project Information
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Content Construction Kit (CCK), Developer
- Reported installs: 2072 sites currently report using this module. View usage statistics.
- Downloads: 10,190
- Last modified: May 11, 2012
