Skip to content

Commit

Permalink
fix(form): submit once
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienClairembault authored and btry committed Oct 3, 2022
1 parent 4d60239 commit b008442
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
});
};

Expand Down

0 comments on commit b008442

Please sign in to comment.