Jump to content

Drop-down to Searchbox


livr517

Recommended Posts

I've looked around for a bit and haven't come across this yet, I apologize in advance if it has already been answered.

   I need to change the schedule search from the default drop down list, to a search box. Both for the departure and arrival airports. I have a fairly large DB of airports and it heavy lags the site when it attempts to load them all under the drop down options. Any suggestions would be much appreciated.

 

I'm using 5.5.x

Link to comment
Share on other sites

Try this

In the file schedule_searchform.php, find this

<div id="depapttab">
  <p>Select your departure airport:</p>
  <select id="depicao" name="depicao">
    <option value="">Select All</option>
    <?php
    if(!$depairports) $depairports = array();
    foreach($depairports as $airport) {
    echo '<option value="'.$airport->icao.'">'.$airport->icao
    .' ('.$airport->name.')</option>';
    }
    ?>
  </select>
  <input type="submit" name="submit" value="Find Flights" />
</div>
<div id="arrapttab">
  <p>Select your arrival airport:</p>
  <select id="arricao" name="arricao">
    <option value="">Select All</option>
    <?php
    if(!$depairports) $depairports = array();
    foreach($depairports as $airport) {
    echo '<option value="'.$airport->icao.'">'.$airport->icao
    .' ('.$airport->name.')</option>';
    }
    ?>
  </select>
  <input type="submit" name="submit" value="Find Flights" />
</div>

Replace it with this

<div id="depapttab">
  <p>Select your departure airport:</p>
	<input type="text" name="depicao" />
  <input type="submit" name="submit" value="Find Flights" />
</div>
<div id="arrapttab">
  <p>Select your arrival airport:</p>
  <input type="text" name="arricao" />
  <input type="submit" name="submit" value="Find Flights" />
</div>

 

Edited by web541
Link to comment
Share on other sites

4 hours ago, web541 said:

Try this

In the file schedule_searchform.php, find this


<div id="depapttab">
  <p>Select your departure airport:</p>
  <select id="depicao" name="depicao">
    <option value="">Select All</option>
    <?php
    if(!$depairports) $depairports = array();
    foreach($depairports as $airport) {
    echo '<option value="'.$airport->icao.'">'.$airport->icao
    .' ('.$airport->name.')</option>';
    }
    ?>
  </select>
  <input type="submit" name="submit" value="Find Flights" />
</div>
<div id="arrapttab">
  <p>Select your arrival airport:</p>
  <select id="arricao" name="arricao">
    <option value="">Select All</option>
    <?php
    if(!$depairports) $depairports = array();
    foreach($depairports as $airport) {
    echo '<option value="'.$airport->icao.'">'.$airport->icao
    .' ('.$airport->name.')</option>';
    }
    ?>
  </select>
  <input type="submit" name="submit" value="Find Flights" />
</div>

Replace it with this


<div id="depapttab">
  <p>Select your departure airport:</p>
	<input type="text" name="depicao" />
  <input type="submit" name="submit" value="Find Flights" />
</div>
<div id="arrapttab">
  <p>Select your arrival airport:</p>
  <input type="text" name="arricao" />
  <input type="submit" name="submit" value="Find Flights" />
</div>

 

Exactly what, I was looking for. Thanks! for the help.

Link to comment
Share on other sites

  • 2 years later...
5 hours ago, Shadesb181 said:

I am using this code on my version of crewcenter now. I am wondering if I can limit the search results. At the moment even if I type KJFK as dep airport, results comeback from the whole database. Any help would be appreciated. Thanks

Hello there, you may use the datatables to paginate your results into seperate pages of a table.

Here it is :
https://datatables.net/

Link to comment
Share on other sites

  • Administrators
14 hours ago, Shadesb181 said:

I am using this code on my version of crewcenter now. I am wondering if I can limit the search results. At the moment even if I type KJFK as dep airport, results comeback from the whole database. Any help would be appreciated. Thanks

When you select KJFK for the departure airport, does it show only KJFK departures or does it show all departures in your database?

If it only shows KJFK departures, you can use pagination to display a smaller number of results per page - as eluded to by Yash. If it displays all schedulesfor your VA when selecting KJFK, you have an error in your coding.

Are you using the default schedule search or an addon module to search?

Link to comment
Share on other sites

22 hours ago, ProAvia said:

When you select KJFK for the departure airport, does it show only KJFK departures or does it show all departures in your database?

If it only shows KJFK departures, you can use pagination to display a smaller number of results per page - as eluded to by Yash. If it displays all schedulesfor your VA when selecting KJFK, you have an error in your coding.

Are you using the default schedule search or an addon module to search?

They key issue is that it shows all the airports, not only JFK

Link to comment
Share on other sites

12 minutes ago, ProAvia said:

Default skin or addon skin?

Try the search using the default skin and see if it displays only KJFK departures when selecting KJFK in the departure box.

What other addon modules do you have installed?

I tested the default skin as requested. In the default skin it works exactly like it should. It only shows JFK dep when i hit search.

I am using Mark Swans CrewCenter. While this skin is enabled, it throws back all airports instead of just JFK.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...