I wanted to do an interdependent select boxes using views exposed filters. So when i select the 1st exposed filter, the second once should filter itself based on first exposed filter value and this should happen dynamically. I tried a lot with form_alter but did not work. Any example or any suggestion as to how to go about it.

  • you obviously need some kind of ajax, did you try this in your trials? also, you may want to look at Wim Leers great module hierarchical select. it does not yet supply views support, but you could maybe get an idea there as how to implement your idea or even supply views support yourself!
    – alex
    Mar 2, 2012 at 18:58
  • @alex - problem is that, the ajax works and after that views ajax again works and takes over it
    – Hacker
    Mar 3, 2012 at 9:06
  • Are you talking about altering the allowed values of the 2nd filter or just setting it's value?
    – googletorp
    Mar 5, 2012 at 12:09
  • @googletorp - Altering the allowed values.
    – Hacker
    Mar 6, 2012 at 5:14

2 Answers 2


The easiest way of solving this, would be to use JavaScript. You need to have all the options available, and with JavaScript you can alter the options based on what's selected. Something like this:

  if ($(this).val() == 'option_1') {
    var options = '<option value="foo">bar</option>';

The above is merely example code but illustrates the approach. You might need to do some work, in order to get the different options that should be available.

  • Yeah i have done this. Problem is that after all the replacement happens, Views ajax submit happens and then the values get changed again.
    – Hacker
    Mar 6, 2012 at 6:56
  • 1
    I think you need to replace $ with jQuery
    – niksmac
    Dec 18, 2012 at 7:17

The Views Dependent Filters module will solve your problem.

Allows the presence of exposed filters on a view to be controlled by values in another exposed filter. Dependent filters are hidden when not relevant, and their values are not considered when the exposed form is submitted.

The module is compatible with both the Views basic and the Better Exposed Filters form plugins.

Not the answer you're looking for? Browse other questions tagged or ask your own question.