[jQuery] AutoComplete - Raising event when custom item is selected
Concerning Jörn Zaefferer autocomplete.
In many cases the autocomplete list is being filled with Key Value
pairs, such as a list of FooBars with their name and id. Using the
result function one would get the id, and drop it into a hidden field.
I want to allow users to either pick an existing FooBars from the
list, or enter a new one if he cannot find a suitable one. But for
that to work I need to know that the autocomplete box contains a
custom item, with other words: an item that was not in the list.
The result event is only triggered whenever an item was picked from
the list.
How would I go about implementing this. My starting point was to add
code to the "blur" event of the autocomplete, yet I can't get enough
information to see if the currentValue is from the list, or a custom
entry.
Thanks,
Gidon