Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent duplicate submissions for cred sign-up #14549

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no null checking here. If the ID on the button changes or is not in place JS will error.

}
</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
Loading