I'm having an issue where I want to give the user the option to cancel their selection after making it. In the onSelect function, I'm wrapping the changes I want to make in a window.confirm function call - which works kinda. Only the field from which the selection was made updates, and all others do not. Is there a "preventDefault()" equivalent I can use in the onSelect function or some other way to abort after the user makes a selection?
$('#firstname, #lastname, #email, #phone, #companyname').devbridgeAutocomplete({
// snipped options and other functions
onSelect: function (suggestion) {
if (window.confirm('Are you sure?')) {
$('#firstname').val(suggestion.firstname);
$('#lastname').val(suggestion.lastname);
$('#email').val(suggestion.email);
$('#phone').val(suggestion.phone);
$('#companyname').val(suggestion.company);
$('#clientid').val(suggestion.data);
$('#address1').val(suggestion.address1);
$('#address2').val(suggestion.address2);
$('#city').val(suggestion.city);
$('#provstate').val(suggestion.provstate);
$('#pocode').val(suggestion.pocode);
$('#country').val(suggestion.country);
}
},
});
I'm having an issue where I want to give the user the option to cancel their selection after making it. In the onSelect function, I'm wrapping the changes I want to make in a window.confirm function call - which works kinda. Only the field from which the selection was made updates, and all others do not. Is there a "preventDefault()" equivalent I can use in the onSelect function or some other way to abort after the user makes a selection?