Selector Element
FAPI Selector Element: jQuery Sortable Selector
Description
This is an extension module for Drupal Forms API that provides jQueryUI linked sortable element as a Forms API element. This element is a multi-selectbox "killer". You would probably want to use it instead of select-box with "#multiple", in many cases, because:
- It looks so much cooler.
- This element provides sorting capabilities that select-box does not.
Syntax
This is how you would use the new element in your form code:
<?php
$form['country_selector'] = array(
'#title' => t('Select Countries'),
'#type' => 'jquery_selector',
'#description' => t('Some description here'),
'#options' => array(
'#enabled' => array('one'=>'one', 'two'=>'two', 'three'=>'three'),
'#disabled' => array('four'=>'four', 'five'=>'five', 'six'=>'six'),
),
'#default_value' => array('one'=>'one', 'two'=>'two', 'three'=>'three', 'four'=>'four', 'five'=>'five', 'six'=>'six'),
);
?>#default_value is used when #options itself or both #enabled and #disabled arrays, in it, are empty. In such case, #disabled array is filled with #default_value and #enabled is set to empty array (Starting position).
Attention
Please make sure that the '#enabled' and '#disabled' arrays are associative arrays with distinct keys! If this condition is not met, proper functioning of the form element can not be guaranteed.
Credits
Developed by: Picktek LLC
Special thanks to: Irakli Nadareishvili for the idea and invaluable suggestions during development.
Related Projects
Similar widget for CCK: MultiSelect.
Releases
| Official releases | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 6.x-1.0-beta2 | 2009-Apr-06 | 33.19 KB | Download · Release notes | Recommended for 6.x | |
