I have a view with an exposed filter as a select list.How can I pass to the exposed filter an argument from the URL?The argument is the Taxonomy ID (tid).I want the exposed filter to show every time the same Taxonomy Id as the Tid that exists on the URL.Is this possible? Thanks
-
I assume from your use of the word argument that you are using Drupal 6, is that correct?– Stan AscherCommented Mar 11, 2012 at 20:09
-
Nope,I am using drupal 7.– DionCommented Mar 12, 2012 at 9:18
-
1OK, in Drupal 7, arguments are called Contexual Filters. You can find them by expanding the Advanced link in your views admin screen. Have you added contextual filters to you view yet?– Stan AscherCommented Mar 12, 2012 at 13:01
-
Yes I have added contextual filters.What I want is to pass an argument from the url to the exposed filter that the view has.Thanks– DionCommented Mar 12, 2012 at 16:14
-
I think I have found a solution on this page drupal.org/node/360780#comment-5722144– DionCommented Mar 12, 2012 at 19:14
1 Answer
Assuming you are using arguments (contextual filters D7.x) you can make another display that is attached to the main display. This attached displays should be programmed to provide a summary list when the argument is not present, and to present the list as a jump menu. You can then set up the jump menu to select the current URL argument (contextual filter). This provides a select menu for an argument, that shows the current argument if it is specified in the URL. An example of this is the results summary page I created for our club's main fundraising race.
The main view page display has three url arguments: year, race category, and gender. The attached view has year as its first argument and race category as the second argument. The second argument is programmed to list available categories (for that year since year is a required argument) if no category URL argument has been specified. When setting up the jump menu settings it was set to "select the current argument". The attached display is also set not to inherit the parent display's arguments. That way when we link (main event page) to a specific category results, the selector shows the results filtering taking place and allows people to easily select a different summary.
Note - this was done in D6.x using Views 2.16
Clarification - it is critical that the attached jump menu display is set not to inherit the parent display's arguments, but that the jump menu is set to display that argument. Otherwise the attached view won't display the jump list when the url argument is present, rather it will display the resulting content (however you set that up). For my results summary page I had to pass the year argument to the attached jump selector view via PHP - eke!!