# Auto-complete without connecting to the server

**URL:** <https://www.ruby-forum.com/t/auto-complete-without-connecting-to-the-server/152619>\
**Category:** Rails\
**Created:** [November 5, 2008, 6:03pm UTC](https://www.ruby-forum.com/t/auto-complete-without-connecting-to-the-server/152619 "2008-11-05T18:03:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@ssk](https://www.ruby-forum.com/u/ssk)\
**Post date:** [November 5, 2008, 6:03pm UTC](https://www.ruby-forum.com/t/auto-complete-without-connecting-to-the-server/152619/1 "2008-11-05T18:03:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ssk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@ssk](https://www.ruby-forum.com/u/ssk)\
**Post date:** [November 5, 2008, 6:26pm UTC](https://www.ruby-forum.com/t/auto-complete-without-connecting-to-the-server/152619/2 "2008-11-05T18:26:43Z")

</div>

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.

> **[GitHub - madrobby/scriptaculous: script.aculo.us is an open-source JavaScript...](https://github.com/madrobby/scriptaculous)**
>
> script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours. - GitHub - madrobby/scriptaculous: script.aculo.us is an open-source JavaScript framework for vis...

Cheers

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

[http://www.zapient.com](http://www.zapient.com)

> **[From Java To Ruby](http://www.fromjavatoruby.com)**
>
> and everything in between...

---

<div class="post-metadata">

**Author:** ![ssk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@ssk](https://www.ruby-forum.com/u/ssk)\
**Post date:** [November 5, 2008, 6:27pm UTC](https://www.ruby-forum.com/t/auto-complete-without-connecting-to-the-server/152619/3 "2008-11-05T18:27:19Z")

</div>

Typo

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

---

<div class="post-metadata">

**Author:** ![ssk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@ssk](https://www.ruby-forum.com/u/ssk)\
**Post date:** [November 5, 2008, 7:06pm UTC](https://www.ruby-forum.com/t/auto-complete-without-connecting-to-the-server/152619/4 "2008-11-05T19:06:55Z")

</div>

Robert Z. wrote:

> Take a look at the local autocompleter wiki, it has all the  
> information you will need.  
> [GitHub - madrobby/scriptaculous: script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.](http://github.com/madrobby/scriptaculous/wikis/autocompleter-local)

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

Sam
