Best way to implement custom search form

543 views Asked by At

Firstly, I am a Drupal newbie and am still alien to many of Drupal's core concepts. My questions probably seem lame but .... I am trying my best.

I want to implement a custom search form like in the picture attached.

enter image description here

Hotel, flight, etc. are taxonomy terms.

Depending on the taxonomy term selected, the parameters below will also change, like in the picture below:

enter image description here

I came across Drupal Search API. I saw the Munich DrupalCon screencast on search api.

http://www.youtube.com/watch?v=rArRwp_1h8Q

From what I have seen so far, I am not sure whether this can be implemented using Search API.

I know this can be implemted using Forms API (I will create the form manually).

I want to know which way will be faster, Forms API or Search API.

I am using : Drupal 7.26

1

There are 1 answers

1
Muhammad Reda On BEST ANSWER

A simple way is to build a regular view with exposed filters.

To add and configure a views exposed filter:

  • Go to your views edit page.
  • Create the filter criteria that we want our users to be able to control, by clicking the "Add" button, in the filter criteria box.
  • Choose the fields that you want your users to be able to filter through them and click "Add".
  • In Configure filter criterion, check the option Expose this filter to visitors, to allow them to change it.
  • Configure the rest of the settings to your liking and click "Next".
  • After saving the view, this filter should be exposed to your users and they are able to search your view.

For a demo with screenshots; Check this tutorial.