I am using the jQuery multiselect widget on another non-Drupal project and I would love to be able to use it with CCK in Drupal 7. I have found this module for CCK multiselect but it is not exactly what I want. I realize I could try to write something, but I was curious if anyone has used the above with Drupal before or if there is a module out there I'm missing.
4 Answers
Not quite what you are requesting but thinking that chosen might be a good alternative to what your searching for.
Since this is Drupal 7 isn't it easier just adding the .js
files to your theme's js
folder and adding this in your info file?
scripts[] = path/to/js/jquery.multiselect.min.js
Add the jquery.multiselect.js and jquery.multiselect.css files to your theme folder, such as /sites/all/themes/your-theme/js/jquery-multiselect/
Then add this to your template.php
drupal_add_js(path_to_theme().'/js/jquery-multiselect/jquery.multiselect.min.js');
drupal_add_css(path_to_theme().'/js/jquery-multiselect/jquery.multiselect.css');
drupal_add_js('$(document).ready(function(){$("#example").multiselect();});', array('type' => 'inline', 'scope' => 'footer', 'weight' => 6));
And to make it only show up on certain nodes types, you can use a preprocess node hook in your template.php:
function your_theme_preprocess_node(&$variables) {
if ($node->type == 'my_content_type') {
drupal_add_js(path_to_theme().'/js/jquery-multiselect/jquery.multiselect.min.js');
drupal_add_css(path_to_theme().'/js/jquery-multiselect/jquery.multiselect.css');
drupal_add_js('$(document).ready(function(){$("#example").multiselect();});', array('type' => 'inline', 'scope' => 'footer', 'weight' => 6));
}
}