Screenshot

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:

  1. It looks so much cooler.
  2. 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.

Project Information

  • Maintenance status: Unknown
  • Development status: Unknown
  • Reported installs: 10 sites currently report using this module. View usage statistics.
  • Downloads: 927
  • Last modified: May 11, 2012

Downloads