v23
have on a “clientsadd” form a simple onblur event on the company name field x_name.when the form is displayed as a web page, the code works as expected, but as a modal form, the code does not fire.
$(document).ready(function() {
$('#x_name').blur(function() {
if($("#x_name").val() == "") return;
$.get(ew.getApiUrl("getLevenshteinMatches") + "/" + encodeURIComponent($("#x_name").val()))
.done(function (msg) {
var msg1 = "";
msg = JSON.parse(msg);
for(var k in msg) {
msg1 += msg[k]["Address"] + ' ' + msg[k]["Postal Code"] + ' ' + msg[k]["Province"] + ' ' +
launch_diff_match(msg[k]["Company"], msg[k]["SearchValue"]) + ' Distance: ' + msg[k]["Distance"] + '<br>';
}
if (msg1 == "") return;
$.alert({
title: 'Did You Possibily Mean One Of These...<br>',
icon: 'fas fa-question',
content: 'We Found Similar Records To '+ $("#x_name").val() +':<br><br>' + msg1,
animation: 'scale',
closeAnimation: 'bottom',
// autoClose: 'cancelAction|15000',
escapeKey: 'cancelAction',
backgroundDismiss: true,
columnClass: 'col-md-6',
buttons: {
cancelAction: {
text: 'Close',
theme: 'modern', // 'material', 'supervan'
btnClass: 'btn-blue',
action: function(){
// do nothing
}
}
}
});
})
.fail(function (msg) {
ew.alert(msg, null, "error");
});
});
});
have confirmed this behavior on two separate forms that JS code is not firing on modal forms, is there another syntax required ?thanks,