How to create a flight search form
May 3, 2017Comments (8)
At our partners’ request we have created a new search form template. With this template, you can create completely unique flight or hotel search forms for your website.
This form supports jquery 1.х and 2.х.
Important note: The template is provided “as is”, all the customization is done by the partner. We do not provide customization services for this template and we do not provide training on the basics of html, js and css. Please use the services of freelancers if you have difficulties in customizing the template.
Table of Contents
What’s included in the archive
- Images: a folder with icons used in the search form.
- Few_forms.html: a template file containing a code with examples of different types of search forms.
- Jquery.js: a file needed for the template to work.
- Jquery.twidget.js: a file with the js code of the search form. This file also contains an example of a code for localizing the search form fields.
- Reset.css, style.css: style files.
Calling the search form in the site code
To place the search form on a site page, use the following code:
where twidget is the parameter for calling the search form code.
Search form settings
When creating a search form, the following parameters can be passed to it:
- Locale: The search form language; this parameter also controls the search result language.
- Marker: An affiliate marker.
- Default_origin: The default departure point. Both IATA code and city name can be used. You don’t need to enter the full name – the auto-complete feature will complete the city name for you.
- Default_destination: The default destination. Both IATA code and city name can be used.
- Default_hotel_location: The default city in the hotel search form.
- Type: search form type:
- Avia: only flight tickets;
- Hotel: only hotels;
- Avia_hotel: combined form; tabs are used for switch over; this is the default value.
- Open_in_new_tab: open search result in a new tab (the default value is true).
Example of search form implementation
On Github, there is a project created with examples of search forms: https://github.com/tp-search-form. An example page is created for each repository. You can change any parameters and see the outcome of such changes.
Examples of search forms: