Monday, October 5, 2009

Interactive search form in Drupal?

facelikebambi - May 20, 2009 - 09:43

Hi

Let's say that I have a simple search form with the following drop-down options:

- UK Region (eg. central, north, south)
- County
- Town/City

So if a visitor selects 'north' Region, the County drop-down would activate and list all the counties in the north. If the visitor then selects a county, the Town/City drop-down would list all the places in that county.

So the visitor can make their geographical search as specific as they like, without having to scroll through a big list of all towns in the UK.

I've been thinking about taxonomy terms for region, county, towns etc but not sure how the search form could be created. Not sure that exposed filters in Views would be able to come close.

A similar question was asked here, many years ago. I'm guessing the answer may be 'write your own module', or change the search format..?

Thanks,
Jason

_

WorldFallz - May 20, 2009 - 17:55

You can do this with the views module and what views calls "exposed filters". You simply create the view you'd like the user to interact with, add filters for the items you want them to interact with, and click the 'expose' button when adding the filter.

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

Hey thanks for the info. I

facelikebambi - May 20, 2009 - 18:21

Hey thanks for the info. I did look at exposed filters in Views, but not sure they give sufficient 'interaction'.

Using my original example, the Counties drop-down should list different options depending on what was selected for UK Region. If UK Region is north, Counties should list all counties in the north. If UK Region is south, list all the counties in the south, etc.

I guess this functionality is too bespoke for an existing module - I'll need to code something!

_

WorldFallz - May 20, 2009 - 18:45

Ah... then you'll want to also add the hierarchical_select module.

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

Thank you so much! :)

facelikebambi - May 20, 2009 - 19:17

Thank you so much! :)

No comments:

Post a Comment