N°2560 Prevent double submit on forms

This commit is contained in:
Stephen Abello
2020-12-09 15:47:43 +01:00
parent b8a42843e0
commit dbda9512e5

View File

@@ -124,6 +124,13 @@ function OnUnload(sTransactionId, sObjClass, iObjKey, sToken)
function OnSubmit(sFormId)
{
if($('#'+sFormId).attr('data-form-state') === 'onsubmit')
{
return false;
}
$('#'+sFormId).attr('data-form-state','onsubmit');
window.bInSubmit=true; // This is a submit, make sure that when the page gets unloaded we don't cancel the action
if ($('#'+sFormId).data('force_submit')) {
@@ -134,6 +141,7 @@ function OnSubmit(sFormId)
if (!bResult)
{
window.bInSubmit = false; // Submit is/will be canceled
$('#'+sFormId).attr('data-form-state', 'default');
}
return bResult;
}