vegui. sk. autocomplete.js

allows the developer to implement auto complete on certain words on user input

Summary
allows the developer to implement auto complete on certain words on user input
Define how many words will show up in the auto-complete drop down list.
Height of the auto-complete dropdown list
The delimiter used to delimit words in the search box.
Initializes the auto-complete module on a form element
Refreshes the elements in the auto-complete list.
Opens the auto-complete list
Closes the auto-complete list
Retrieve the string that the caret (text-cursor) is currently positioned in
Returns the next element in the list
Returns the previous element in the list
Select entry in the list

Constants

VSK_AUCO_LIST_SPACE

Define how many words will show up in the auto-complete drop down list.  The more words the more processing time will be needed.

Be smart with this setting, the user wont be able to do much with over 10 words anyways.

5-10 is a good number (default = 5) (px)

VSK_AUCO_LIST_HEIGHT

Height of the auto-complete dropdown list

(default = 100) (px)

VSK_AUCO_DELIMITER

The delimiter used to delimit words in the search box.  If a delimiter is set the auto-completion will work individually for strings delimited by the set delimiter.

Set it to null in order to have auto-completion on the whole input field

regex supported

(default = ‘\s?,\s?’)

Functions

vsk_auco_init

function vsk_auco_init(id,
words)

Initializes the auto-complete module on a form element

Parameters

var idnode id of the form element
array wordsarray holding words (auto-complete list)

Example for words array

words = ['apple','banana','air'];

VSK_Node

Summary
Refreshes the elements in the auto-complete list.
Opens the auto-complete list
Closes the auto-complete list
Retrieve the string that the caret (text-cursor) is currently positioned in
Returns the next element in the list
Returns the previous element in the list
Select entry in the list

Functions

auco_refresh

VSK_Node.prototype.auco_refresh = function()

Refreshes the elements in the auto-complete list.  Opens the auto-complete list if there is at least one matching element and closes it if there are none.

auco_open_list

VSK_Node.prototype.auco_open_list = function(words)

Opens the auto-complete list

Parameters

<array words>words to populate the autocomplete list with

auco_close_list

VSK_Node.prototype.auco_close_list = function()

Closes the auto-complete list

auco_caret_string

VSK_Node.prototype.auco_caret_string = function(d,
replace,
dr)

Retrieve the string that the caret (text-cursor) is currently positioned in

Parameters

<string d>delimiter
<string replace>replace the string at the current caret positon with this string
<string dr>if replace is set, rebuild the string with this delimiter

auco_list_next

VSK_Node.prototype.auco_list_next = function()

Returns the next element in the list

auco_list_prev

VSK_Node.prototype.auco_list_prev = function()

Returns the previous element in the list

auco_list_select

VSK_Node.prototype.auco_list_select = function(node)

Select entry in the list

Parameters

<Node node>html node of the item in the autocomplete list that should be selected
function vsk_auco_init(id,
words)
Initializes the auto-complete module on a form element
VSK_Node.prototype.auco_refresh = function()
Refreshes the elements in the auto-complete list.
VSK_Node.prototype.auco_open_list = function(words)
Opens the auto-complete list
VSK_Node.prototype.auco_close_list = function()
Closes the auto-complete list
VSK_Node.prototype.auco_caret_string = function(d,
replace,
dr)
Retrieve the string that the caret (text-cursor) is currently positioned in
VSK_Node.prototype.auco_list_next = function()
Returns the next element in the list
VSK_Node.prototype.auco_list_prev = function()
Returns the previous element in the list
VSK_Node.prototype.auco_list_select = function(node)
Select entry in the list