Hierarchical Select 2

published on March 3, 2008

What is Hierarchical Select?

For those who don’t know Hierarchical Select yet, or HS in short, this is a module that provides a new form element. If you’re new to Drupal, you may just have frowned upon reading that. A ‘form element’ in Drupal’s Forms API is something like a button, select or textarea element in HTML, or a GUI widget in a GUI.

Now, the goal of HS is actually very narrow: making selections in hierarchies (hence its name) really simple: improve usability. The prime example and candidate for this is of course Drupal’s Taxonomy module. The idea is to first select an item from the root level, then pick one of its children (if it has any), then one of the children of the selected child (if it has any), and so on.

New and Improved

There are many new features in version 2 of Hierarchical Select (or HS in short):

  • Multiple select support (sponsored by Marmaladesoul), which makes HS now suitable for almost every use case
  • Setting to set the title of the dropbox. (“dropbox” is how I decided to call the listing of items that have already been selected when multiple select is enabled.)
  • Level labels, only for the root level if the user must pick an item from the deepest level, otherwise a level label for each level.
  • Setting to disable or enable level labels.
  • Setting to add an “” option.
  • Setting to specify the maximal number of selected items.
  • Site-wide setting for level label styles.
  • Site-wide setting for the animation delay.
  • Integration with the Taxonomy Subscriptions module (sponsored by Mr Bidster Inc.).

But also several improvements:

  • Much improved API! Module developers, start using this form element! You can even support it dynamically, i.e. use it when it’s available. More about that in this article.
  • Setting that allows the user to only save the deepest term, or the entire lineage.
  • Setting that allows a user to pick the deepest item from any level, or forces to pick an item from the deepest level.
  • Much more usable configuration form for the Taxonomy implementation: JS fanciness for dependent settings!
  • Operators in Views’ exposed filters can be used now, thanks to multiple select support.
  • Submit buttons of the form are disabled until the AHAH request has completed. The selects in the hierarchical select element are also disabled.

Hierarchical Select Playground

By now you should be either drooling or bored. So it’s play time! And developers: don’t forget to check out the article I wrote for you.

Comments

hendrik's picture

hendrik

Thank you very much! I’ve used version 1 for a while now and i’m very pleased with the improvements. Keep up the good work!

Richard Sheppard's picture

Dear Wim,

Excellent work! I saw version 1 a few months and was waiting for a project on which I could use it. I think the project is about to start now (well an upgrade to an existing site) and I nearly forgot about Hierarchical Select - shame on me!

Now, looking at what is possible now, I’m considering approaching every project with a reason to build hierarchical vocabs so I can use this!

Thank you!

Cheers,

Richard