views:

211

answers:

1

Hello, I'm using the following JQUERY Autocomplete plug-in: jQuery Plugin: Tokenizing Autocomplete Text Entry

What'd I'm unable to figure out is how to add a value to the list from outside of the autocomplete dropdown list.

The reason I want to do this is the autocomplete searches for locations, if a location is not found, there is an "ADD" modal dialog where users can add a location. After they add/submit the location I would like that new value to be automatically added to the autocomplete input.

Here is the JS I'm trying to get to submit the new value to the autocomplete input:

$.TokenList.submitLocation.add_token_values("99", "Alpha");

Here's the JS that initiates the Autocomplete input:

$(function(){               
$("#locationlist").tokenInput("/locations/autosuggest/", {
hintText: "Type the location name",
noResultsText: "No results",
searchingText: "Searching...",
callback: submit locationList
})
});

** I've found in jquery.tokeninput.js, the function add_token (item), but haven't been able to call it successfully.

Ideas?

+1  A: 

Check out http://github.com/chadisfaction/jQuery-Tokenizing-Autocomplete-Plugin. It is a slightly modified version of the one you pointed to on loopj.com The only thing it doesn't seem to do well (and I plan on fixing it at some point and submitting a patch to the author) is taking tags that already existed and putting them in the box already.

Eric Lubow