Skip to content

Commit 10361bf

Browse files
committed
Temporarily disable the Send Signed Form button after submit
1 parent d1d84e6 commit 10361bf

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

backend/assets/twoPercentForm.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default function() {
1010
this.form = document.getElementById("two-percent-form");
1111
this.signatureInput = document.getElementById("signature-input");
1212
this.signaturePreview = document.getElementById("signature-preview");
13+
this.submitButton = document.getElementById("submit-with-signature");
1314

1415
this.pristine = new Pristine(this.form, {
1516
errorTextClass: "mt-2 text-sm text-red-600",
@@ -25,9 +26,17 @@ export default function() {
2526
}
2627
}, "Acest câmp este obligatoriu", 2, false);
2728
},
29+
tempDisableSubmitButton() {
30+
this.submitButton.disabled = true;
31+
setTimeout(function() { this.enableSubmitButton(); }, 5000);
32+
},
33+
enableSubmitButton() {
34+
this.submitButton.disabled = false;
35+
},
2836
sendSignedForm() {
2937
this.validateSignature = true;
3038
if (this.pristine.validate()) {
39+
this.tempDisableSubmitButton();
3140
this.form.submit();
3241
}
3342
},

0 commit comments

Comments
 (0)