[jQuery] [Autocomplete] Detecting mustMatch failure.
I have a number of fields that are using the AutoComplete plugin
instead of select menus. When a user enters and selects a match a
number of other fields are populated via a .getJSON.
$("#f_orig_lookup")
.autocomplete(
"index.php",
loc_lookup_obj) // loc_lookup_obj is a shared configuration object.
.result(function(event, data, formatted) {
if (data){
$.getJSON(
"?type=remote&action=location_by_id&id="+data[1],
function(data){
loadLocationInfo(data,'orig');
});
} else {
// debug
alert ('no data'); // <- THIS NEVER ALERTS
}
});
The problem I have is this. A user does a lookup, then returns to the
same field and enters non-matching text. The mustMatch causes the
autocomplete field to clear, but the autocomplete .result doesn't
fire
What I need to do is clear any pre-filled fields if mustMatch. Is
there any easy way to detect that the mustMatch did it's job?