Views filters auto submit with Hierarchical Select (Drupal 6)

In Drupal 6, Views Filters can be automatically submitted (without pressing apply button) using a simple JQuery trick like this one (or using Views Hacks module)

$('.views-widget select').change(function() {
  $(".view-filters form").submit();
});

But if you are also using Hierarchical Select module this won't be that easy. If you just need the code to get the idea, here is it :

$('.views-widget .selects select').change( function() {
    $(this.parentNode.parentNode.parentNode).bind('change-hierarchical-select', function() {
    $(".view-filters form").submit();
  })
});

All we needed to do was binding our function to one of the events supplied by the hierarchical select module (the "change-hierarchical-select" event), you can read more about these events in the API.txt file supplied with the module.

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.