CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: General Discussions: General Questions:
Auto-complete search form

 



Mantaii
New User

Aug 4, 2016, 1:30 AM

Post #1 of 5 (5033 views)
Auto-complete search form Can't Post

Hi
I'm new to Perl but the company I work for has just bought a new CMS / booking reservation website which is hosted by an external company and it runs on Perl.

I'm trying to find out whether there is a way of creating a auto-complete search form for our site. There isn't any search functionality built in to the system for the front-end which is annoying.

Our current solution which is built in .Net C# allows customers to type in a destination or hotel and the search will suggest places as soon as you start typing. This is useful as customers don't need to worry about spelling so much.

The company say they can provide us a CSV file which we can search, is this a good option or should I see if we can get access to the destination and hotel location DB tables?

Hope someone can help, thanks.


Laurent_R
Veteran / Moderator

Aug 5, 2016, 11:58 AM

Post #2 of 5 (5006 views)
Re: [Mantaii] Auto-complete search form [In reply to] Can't Post

A CSV file won't have a fast lookup, but I suspect the idea is to load the data from the CSV into a data structure in memory enabling fast lookup. You don't provide enough information in my view to get any more solid answer.


Mantaii
New User

Aug 11, 2016, 9:01 AM

Post #3 of 5 (4929 views)
Re: [Laurent_R] Auto-complete search form [In reply to] Can't Post

Hi
I'm just looking at options because it's a new system and I don't have access to a database. The supplier will only give me access to a CSV file and then I need to work out how to do the search myself.

What information would you need to help me further? Happy to provide as much info as I can :)

Thanks.


Laurent_R
Veteran / Moderator

Aug 11, 2016, 10:58 AM

Post #4 of 5 (4926 views)
Re: [Mantaii] Auto-complete search form [In reply to] Can't Post

You probably have to load the data from the CSV into a data structure in memory (probably a hash) if you need fast lookup.

But I can't help you further if you don't provide a sample of the CSV file and the type of lookup you'll need to perform (i.e. which are the fields that you expect to use as keys for the search).


FishMonger
Veteran / Moderator

Aug 11, 2016, 2:07 PM

Post #5 of 5 (4923 views)
Re: [Mantaii] Auto-complete search form [In reply to] Can't Post

Autocomplete fields in web apps is normally done on the client side via javascript instead of in perl on the server side.

When the page is called, the perl script will read the csv file and use it to build the javascript vars. Then event handlers (probably onchange) are used to "monitor and update" the field with each keystroke.

https://www.google.com/search?q=javascript+autocomplete&ie=utf-8&oe=utf-8

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives