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 (wikipedia entry). 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 and a simple Java servlet (to emulate the database access bit).