Can I use one single exposed filter to filter multiple block views on a different page?

6.9k Views Asked by At

I have four block views on a page (call it "info" page) that are filtered by proximity to give me four pieces of information relating to one particular filtered location.

I would like to be able to create an intro page with an exposed proximity filter that when executed would take me to the (info) page and simultaneously filter the four views with the proximity entered on the intro page.

How can I do this? I am new to php but learning .... willing to work at it!

Thanks

1

There are 1 best solutions below

2
On

If you're using Views in Drupal 6, the answer is yes -- with some important caveats.

Unlike normal forms in Drupal, Views' exposed filter values come in as $_GET params raher than $_POST. That means that you can populate an exposed filter just by appending ?filter=value&filter2=value2 etc... to the current URL.

The kicker is that if multiple views on the same page are looking for the same filter keys in the URL, they will both use the incoming filter value. You'll need to configure each view's list of exposed filters to make sure that they all user the same list of filters, with the same list of 'keys' for the incoming values. If you want the filter form to only appear once, you may have to do some crafty juggling as well--Views will want it to appear on each view by default, but there's an option on each view to move its exposed filters to a block; doing that and NOT enabling the exposed filter block effectively hides the view's exposed filter widgets, while keeping the filtering active if it comes in via the URL.

To summarize: make sure all four views have the same list of exposed filters, and are using the same 'keys' for the filters. Hide the exposed filter widgets on all but one of the views. At that point, it should work.