Sometimes data subform are recorded twice when the user just click on the Save button. How is this possible?

Thanks for ur help !
Code: Select all
function nuOnLoad() {
// Disable the save button for 1.5 seconds to prevent a user from double-clicking it.
$('#nuSaveButton').click(function() {
nuDisable('nuSaveButton');
setTimeout(
function() {
nuEnable('nuSaveButton');
}, 1500);
});
}
Code: Select all
function nuOnLoad() {
// .. other code if exists
// disable double click for Save, Add and Print buttons
if(nuFormType() == 'edit') {
$('#nuSaveButton').attr('onclick','field=this.id; nuDisable(field); nuSaveAction(); setTimeout(function(){nuEnable(field);},2000);');
}
if(nuFormType() == 'browse') {
$('#nuAddButton').attr('onclick','nuDisable(this.id); nuAddAction();');
$('#nuPrintButton').attr('onclick','field=this.id; nuDisable(field); nuPrintAction(); setTimeout(function(){nuEnable(field);},2000);');
}
}
Code: Select all
// After clicking a nuActionButton (Save, Delete, Print, Clone etc.), disable it for 1.5 secs to prevent a user from double-clicking it.
function preventButtonDblClick() {
$('.nuActionButton').click(function() {
var id = $(this).attr("id");
nuDisable(id);
setTimeout(
function() {
nuEnable(id);
}, 1500);
});
}
function nuOnLoad() {
preventButtonDblClick();
}