Friday, January 11, 2008

You want Google Suggest style autocomplete, right? My advice is use a JavaScript library!

In November 2005 I created a simple Google Suggest clone based on the periodic table (and updated my findings a few months later). Some anonymous commenter recently requested the source of this example. I have no qualms about providing the exact code if they really want. However, if I were implementing such a thing right now (in 2008) I would probably just use a suitable JavaScript library. One of my favourite JavaScript libraries that emerged around about the same time as I wrote my original article is script.aculo.us (wikipedia entry). Script.aculo.us has a strong association with Ruby on Rails but there is nothing particularly framework specific about the library. Simply use the library where you would have previously used JavaScript. IMHO, there is a little too much activity trying to force particular JavaScript libraries into what should be library agnostic development frameworks.

So once again, here is the periodic table suggest example but this time implemented with script.aculo.us and a simple Java servlet (to emulate the database access bit).

http://cse-mjmcl.cse.bris.ac.uk/periodicTableSuggest2/

2 comments:

ismjml said...

I totally agree. I use the script.aculo.us implementation of autocomplete and its great. I had tried to roll my own solution several times and nothing I wrote was anywhere near as elegant as the script.aculo.us function.
Note: Comment imported. Original by Zachary Abresch website: http://www.roundus.com at 2008-01-30 22:02

prathap kumar said...

Interesting Article
Javascript Training in Chennai | JavaScript Training Courses