bug fix: Prevent API forms from being submitted multiple times

- A problem if you're a manic clicker
This commit is contained in:
Oliver 2021-07-09 01:06:38 +10:00
parent 9947a0cf90
commit 60e8a17f07

View File

@ -511,6 +511,10 @@ function insertConfirmButton(options) {
*/
function submitFormData(fields, options) {
// Immediately disable the "submit" button,
// to prevent the form being submitted multiple times!
$(options.modal).find('#modal-form-submit').prop('disabled', true);
// Form data to be uploaded to the server
// Only used if file / image upload is required
var form_data = new FormData();
@ -778,6 +782,9 @@ function clearFormErrors(options) {
*/
function handleFormErrors(errors, fields, options) {
// Reset the status of the "submit" button
$(options.modal).find('#modal-form-submit').prop('disabled', false);
// Remove any existing error messages from the form
clearFormErrors(options);