I have a field "mobileNo" in a table with a lookup attached to it and a function to run on change.
the function make a validation if tblID column has data come from lookup so it alert user that this number already exist. and it working properly in first row. problem i have when try to adding anew row alert come twice. here is what i tried:
$(document).ready(function(){
$(document).on("lookupcomplete", function () {
checkNos();
$('.tbl1 tbody').on('change', '.mobileNo input', checkNos);
function checkNos() {
$('.tbl1 tbody tr').each(function () {
$(this).find('.mobileNo input').each(function () {
var tblID = $(this).closest('tr').find('.tblID input').val();
if (tblID !="" && $('#q10 input:checked').val()=="New"){
alert('This mobile no already exist!');
$(this).closest('tr').find('.tblID input').val("")
$(this).closest('tr').find('.mobileNo input').val("");
}else{
}
});
});
}
});
});
here image for table columns
and this is the lookup rule i did