Autocompleter.Local |
The local array autocompleter.
Used when you’d prefer to inject an array of autocompletion options into the page, rather than sending out Ajax queries.
Syntax
new Autocompleter.Local(inputElement, choicesElement, dataArray, [options])
The constructor takes four parameters. The first two are, as usual, the id of the monitored textbox, and id of the autocompletion menu. The third is an array of strings that you want to autocomplete from, and the fourth is the options block.
Extra local autocompletion options:
It’s possible to pass in a custom function as the ‘selector’ option, if you prefer to write your own autocompletion logic. In that case, the other options above will not apply unless you support them.
Example
<p><label for="bands_from_the_70s">Your favorite rock band from the 70's:</label><br /> <input id="bands_from_the_70s" autocomplete="off" size="40" type="text" value="" /></p>
<div class="page_name_auto_complete" id="band_list" style="display:none"></div>
<script type="text/javascript"> new Autocompleter.Local('bands_from_the_70s', 'band_list', ['ABBA', 'AC/DC', 'Aerosmith', 'America', 'Bay City Rollers', 'Black Sabbath', 'Boston', 'David Bowie', 'Can', 'The Carpenters', 'Chicago', 'The Commodores', 'Crass', 'Deep Purple', 'The Doobie Brothers', 'Eagles', 'Fleetwood Mac', 'Haciendo Punto en Otro Son', 'Heart', 'Iggy Pop and the Stooges', 'Journey', 'Judas Priest', 'KC and the Sunshine Band', 'Kiss', 'Kraftwerk', 'Led Zeppelin', 'Lindisfarne (band)', 'Lipps, Inc', 'Lynyrd Skynyrd', 'Pink Floyd', 'Queen', 'Ramones', 'REO Speedwagon', 'Rhythm Heritage', 'Rush', 'Sex Pistols', 'Slade', 'Steely Dan', 'Stillwater', 'Styx', 'Supertramp', 'Sweet', 'Three Dog Night', 'The Village People', 'Wings (fronted by former Beatle Paul McCartney)', 'Yes'], {}); </script>
|