From 0cbc7ead94a01b557e5fe42a16f8ce372039c0b5 Mon Sep 17 00:00:00 2001 From: Charles Prichard Date: Wed, 27 Sep 2023 10:30:31 +0100 Subject: [PATCH] CR comments --- common/static/common/js/buttonDebounce.js | 7 +++---- measures/jinja2/measures/create-review.jinja | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/static/common/js/buttonDebounce.js b/common/static/common/js/buttonDebounce.js index 0bfb5b469..aa38b7de9 100644 --- a/common/static/common/js/buttonDebounce.js +++ b/common/static/common/js/buttonDebounce.js @@ -1,9 +1,8 @@ -let button = document.querySelectorAll('span.add-debounce > button')[0] +let button = document.getElementById('add-debounce') const debounceButton = () => { - if (!button) { - return - } else if (button) { + if (button) { + console.log('button', button) addEventListener('submit', function() { button.disabled = true, alert("Your action is being processed and the submit button is now disabled. You will be taken to a confirmation screen once the action has been processed.")} diff --git a/measures/jinja2/measures/create-review.jinja b/measures/jinja2/measures/create-review.jinja index 5657d0336..fc4aa65a9 100644 --- a/measures/jinja2/measures/create-review.jinja +++ b/measures/jinja2/measures/create-review.jinja @@ -130,5 +130,5 @@ {% endif %} {% endcall %} - {{ govukButton({"text": "Create", "preventDoubleClick": true, css_class:"test"}) }} -{% endblock %} + {{ govukButton({"text": "Create", "preventDoubleClick": true, "attributes": {"id": "add-debounce"},}) }} +{% endblock %} \ No newline at end of file