Skip to content

Commit

Permalink
disable submission after the form gets submitted (#14549)
Browse files Browse the repository at this point in the history
  • Loading branch information
usamabinnadeem-10 authored Dec 10, 2024
1 parent 08c2558 commit 0d67317
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 9 additions & 0 deletions templates/credentials/sign-up.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
{% endblock meta_copydoc %}

{% block content %}
<script>
function getSubmitButton() {
return document.getElementById('formSubmitButton');
}

function disableSubmit() {
getSubmitButton().disabled = true;
}
</script>
{% if error %}
<div class="p-notification--negative">
<div class="p-notification__content">
Expand Down
2 changes: 1 addition & 1 deletion templates/shared/_credentials-signup-sme-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ <h1>Sign-ups for the CUE Beta are now closed</h1>
}

function getCustomFields() {
disableSubmit();
const nativeLanguage = document.getElementById("NativeLanguage");
const jobTitle = document.getElementById("JobTitle");

Expand Down Expand Up @@ -845,7 +846,6 @@ <h1>Sign-ups for the CUE Beta are now closed</h1>
"ApplicationType": "Exam SME",
"Country": country.value
}
console.log(data);

const textarea = document.getElementById("Comments_from_lead__c");
textarea.value = JSON.stringify(data);
Expand Down
3 changes: 1 addition & 2 deletions templates/shared/_credentials-signup-tester-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ <h1>Sign-ups for the CUE Beta are now closed</h1>
}

function getCustomFields() {
disableSubmit();
// disable submit button when form is submitted to stop duplicates
document.getElementById("formSubmitButton").setAttribute("disabled", "true");

Expand Down Expand Up @@ -817,8 +818,6 @@ <h1>Sign-ups for the CUE Beta are now closed</h1>
"Country": country.value
}

console.log(data);

const textarea = document.getElementById("Comments_from_lead__c");
textarea.value = JSON.stringify(data);
}
Expand Down

0 comments on commit 0d67317

Please sign in to comment.