diff --git a/js/scripts.js b/js/scripts.js index bee6e6ef2..c40e6e571 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -1381,6 +1381,10 @@ var plugin_formcreator = new function() { var form = document.querySelector('form[data-itemtype]'); var data = new FormData(form); data.append('submit_formcreator', ''); + + // Disable submit button + $(form).find("button[type=submit]").prop('disabled', true); + $.post({ url: formcreatorRootDoc + '/ajax/formanswer.php', processData: false, @@ -1404,6 +1408,9 @@ var plugin_formcreator = new function() { $('#messages_after_redirect').append(html); initMessagesAfterRedirectToasts(); } + }).always(function (data) { + // Enable submit button + $(form).find("button[type=submit]").prop('disabled', false); }); };