YUI Autocomplete Editing Issue

75 views Asked by At

I am creating a webform and am in need of a textarea with autocomplete that pulls from a list of streets I've created. I have been using YUI3 Autocomplete widget and it has been working great, but I cannot seem to go back to a previous word and change it to another with the Autocomplete dropdown event.If anyone knows a solution to this it would be much appreciated.

Edit: Added code below. Example: Operate regular route to State St then turn right. So if I delete only State St and try to change it to Lake St the suggestion dropdown does not work. JSFiddle

<textarea class="form-control" rows="8" id="rerouteInstruct0" spellcheck="true"  placeholder="EX. Operate regular route to State St and Lake St (turn right)"></textarea>

//Javascript for YUI below
loadTheStreets(); //loads a list of streets from the server
//adds autocomplete function to reroute instruction field
YUI().use('autocomplete', 'autocomplete-highlighters', 'autocomplete-
filters', function (Y) {
Y.one('body').addClass('yui3-skin-mine');
Y.one('#rerouteInstruct0').plug(Y.Plugin.AutoComplete, {
    resultHighlighter: 'startsWith',
    resultFilters: 'startsWith',
    queryDelimiter: ' ',
    source: streetList[0]
  });

});
YUI().use('autocomplete', 'autocomplete-highlighters', 'autocomplete-
filters', function (Y) {
Y.one('body').addClass('yui3-skin-sam');
Y.one('#rerouteInstruct0').plug(Y.Plugin.AutoComplete, {
    resultHighlighter: 'startsWith',
    resultFilters: 'startsWith',
    queryDelimiter: '\n',
    source: streetList[0]
  });
});  
0

There are 0 answers