-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(EMS-1345): Disable submit buttons when a form is submitting (#557)
* fix(EMS-1345): UI application creation requests - revert previous changes and immediately wipe eligibility answers from the session * fix(EMS-1345): disable submit buttons on form submission * fix(EMS-1345): submit button nunjucks component * fix(EMS-1345): remove unused function * fix(EMS-1345): align create application instances in UI controllers * fix(EMS-1345) use const instead of var in form-submission script * chore(tech): fix/update E2E test * fix(EMS-1345): fix typos * fix(EMS-1345): fix/update failing E2E test * chore(tech): temporarily disable failing E2E test due to newly found bug * fix(EMS-1345): revert previous commit disabling test, fix company details submit button issue * fix(EMS-1345): revert E2E test changes
- Loading branch information
Showing
63 changed files
with
273 additions
and
353 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const form = document.getElementById('form'); | ||
const submitButton = document.getElementById('submit-button'); | ||
|
||
/** | ||
* Disable the submit button. | ||
* This prevents a user from spamming the button. | ||
*/ | ||
const disableButton = () => { | ||
submitButton.setAttribute('disabled', 'true'); | ||
submitButton.setAttribute('aria-disabled', 'true'); | ||
submitButton.classList.add('govuk-button--disabled'); | ||
}; | ||
|
||
/** | ||
* If a form exists, | ||
* Add a submit event listener. | ||
* When submitted, disable the submit button | ||
*/ | ||
if (form) { | ||
form.addEventListener('submit', () => { | ||
disableButton(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% from 'govuk/components/button/macro.njk' import govukButton %} | ||
|
||
{% macro render(params) %} | ||
|
||
{% set text = params.text %} | ||
{% set isStartButton = params.isStartButton %} | ||
{% set classes = params.classes %} | ||
{% set href = params.href %} | ||
{% set formaction = params.formaction %} | ||
|
||
{{ govukButton({ | ||
text: text, | ||
isStartButton: isStartButton, | ||
classes: classes, | ||
href: href, | ||
attributes: { | ||
'data-cy': 'submit-button', | ||
id: 'submit-button', | ||
formaction: formaction | ||
} | ||
}) }} | ||
|
||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.