mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
bug fix: Prevent API forms from being submitted multiple times
- A problem if you're a manic clicker
This commit is contained in:
parent
9947a0cf90
commit
60e8a17f07
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user