Lmillard
asked on
jquery autocomplete - clear form field upon no results
Hi,
Hopefully an easy one this.
I am using the jQuery autocomplete plugin to connect to a coldfusion cfc and return database information.
If the database returns results and the user selects the value this then populates form fields for subsequent submission BUT if the user then amends the search and enters text with no results the 'jetId' field retains the original select value as not results were found and of course no select happened.
Can anyone suggest a way of clearing the jetId field upon no results being returned?
Regards
Leigh
Hopefully an easy one this.
I am using the jQuery autocomplete plugin to connect to a coldfusion cfc and return database information.
If the database returns results and the user selects the value this then populates form fields for subsequent submission BUT if the user then amends the search and enters text with no results the 'jetId' field retains the original select value as not results were found and of course no select happened.
Can anyone suggest a way of clearing the jetId field upon no results being returned?
Regards
Leigh
$(function() {
$("#jets").autocomplete({
source: httpPath+"assets/publicComps/autoComplete.cfc?method=jets&returnformat=json",
select:function(event,ui) {$("#jetId").val(ui.item.id)}
});
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER