From 297f3a39849f586c2ead7f7ec1519ce5ce4398cc Mon Sep 17 00:00:00 2001 From: Tasos Katsoulas Date: Wed, 20 Nov 2024 18:41:08 +0200 Subject: [PATCH] Enable Update button on selection --- kitsune/sumo/static/sumo/js/flagit.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kitsune/sumo/static/sumo/js/flagit.js b/kitsune/sumo/static/sumo/js/flagit.js index 9ca6eae5ed7..47dc66995d8 100644 --- a/kitsune/sumo/static/sumo/js/flagit.js +++ b/kitsune/sumo/static/sumo/js/flagit.js @@ -63,7 +63,7 @@ document.addEventListener('DOMContentLoaded', () => { } function initializeDropdownsAndTags() { - document.querySelectorAll('.topic-dropdown, .tag-select').forEach(dropdown => { + document.querySelectorAll('.topic-dropdown, .tag-select, select[name="status"]').forEach(dropdown => { const questionId = dropdown.dataset.questionId; dropdown.addEventListener('change', async function () { @@ -111,6 +111,18 @@ document.addEventListener('DOMContentLoaded', () => { } }); } + + if (dropdown.name === 'status') { + dropdown.addEventListener('change', function () { + const form = this.closest('form'); + const updateButton = form.querySelector('input[type="submit"]'); + if (this.value) { + updateButton.disabled = false; + } else { + updateButton.disabled = true; + } + }); + } }); }