Skip to content

Commit

Permalink
Disable textarea in the vote widget (#6463)
Browse files Browse the repository at this point in the history
  • Loading branch information
akatsoulas authored Jan 21, 2025
1 parent 2f24ef9 commit 058f822
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions kitsune/sumo/static/sumo/js/survey_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ document.addEventListener('alpine:init', () => {
this.isOtherNotSelected = radio.value !== 'other';

if (textarea) {
textarea.disabled = radio.value !== 'other';
textarea.required = radio.value === 'other';
textarea.disabled = !this.isOtherSelected;
textarea.required = this.isOtherSelected;
}

this.updateSubmitDisabled();
});
});

// Setup textarea
if (textarea) {
textarea.disabled = true;
textarea.addEventListener('input', (event) => {
this.comment = event.target.value;
if (this.comment.length > this.maxLength) {
Expand All @@ -48,7 +48,6 @@ document.addEventListener('alpine:init', () => {
});
}

// Setup form submission
if (form) {
form.addEventListener('submit', (event) => {
event.preventDefault();
Expand Down

0 comments on commit 058f822

Please sign in to comment.