vegUI.org home of the javascript based window manager and AJAX framework

VegUISiteKit: Autocomplete

The autocomplete library lets you add an autocomplete feature to any text input element like input and textarea. It also supports tag based input meaning that if a delimiter is defined the autocomplete feature will work separately for each tag. If no delimiter is specified it will work like a regular autocomplete feature.

Demonstration

List of words:

apple, ape, age, orange, banana, bus, beard, pineapple, strawberry

When a partially matching word is found a list will popup, you can cycle through the entries in the list with the UP and DOWN keys. Once you start typing again or hit the RIGHT key the currently selected entry will be kept.

Tag based autocomplete mode (separate tags with ,)

Example Code:

Code: HTML
<form>
<input type="text" id="autocomplete_box" style="width: 400px" />
</form>
Code: CSS
/* note that the css classes begin with node id 
of the input box (autocomplete_box in this case) */

div.autocomplete_box_auco_list {
  border: 1px black solid;
  padding: 5px;
  font: 11px Verdana, Arial;
  background-color:#fff;
}

div.autocomplete_box_normal { }

div.autocomplete_box_selected {
  background-color: lightblue;
  color: darkblue;
}
Code: Javascript
Words = ['apple', 'age', 'ape','orange', 'bus', 'beard', 'banana','pineapple','strawberry'];
vsk_auco_init('autocomplete_box',Words);

Dependencies:

Instead of downloading all packages and dependencies manually it is recommended that you use the new compiled download script, as it will automatically compile all selected libraries - including dependencies - into one compact javascript file for you to download.

This library is dependent on at least one other VSK library so make sure you download the libraries in the list below.

file-name description
vegui.sk.std.js VSK Core Library
vegui.sk.formtools.js VSK Form Tools

Download (22 November 2007)

This package contains the code in both commented and compressed forms. The compressed version has had it's comments and unnecessary whitespace removed in order to reduce it's size.

download version
tar.gz (4,6 KB),
zip (7,6 KB)
0.1.0 (beta)

Tutorials on using this library

BETA notice

While this library is in BETA phase YOU can help get it out of there quicker by submitting any bugs you may find to the bug database. Thanks for helping ;)

Changelog

2007.03.10 - vegu@vegui.org
        * version 0.1.0