Auto-complete without connecting to the server


#1

Hi,

My client wants to type instead of select from a list.
But it’s not just a free typing but typing the first few letters.
So basically, it’s auto-complete function except that the list data is
already in the client as an array in JavaScript.

Is there any plugin for such a function?
If not, how would you implement it?

Thanks.

Sam


#2

Sam,
I am unaware of any plugins for this, maybe there is one someone.
Fortunately though It is trivial to implement with the Scriptaculous
library.

Basically the syntax is
new Autocompleter.Local(id_of_text_field, id_of_div_to_populate,
array_of_strings, options);

Take a look at the local autocompleter wiki, it has all the
information you will need.
http://github.com/madrobby/scriptaculous/wikis/autocompleter-local

Cheers


Robert Z.
Zapient, LLC
Ruby on Rails Development and Consulting

http://www.zapient.com
http://www.fromjavatoruby.com


#3

Typo

…maybe there is one someone --> …maybe there is one somewhere.


#4

Robert Z. wrote:

Take a look at the local autocompleter wiki, it has all the
information you will need.
http://github.com/madrobby/scriptaculous/wikis/autocompleter-local

Thank you very much.
This is exactly what I was looking for.

Sam