Skip to content

Commit

Permalink
Make textare required on specific choices (#6464)
Browse files Browse the repository at this point in the history
  • Loading branch information
akatsoulas authored Jan 21, 2025
1 parent 058f822 commit 70acaee
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions kitsune/sumo/static/sumo/js/survey_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ document.addEventListener('alpine:init', () => {
radio.addEventListener('change', () => {
this.selectedReason = radio.value;
this.isOtherSelected = radio.value === 'other';
this.isOtherNotSelected = radio.value !== 'other';

if (textarea) {
textarea.disabled = !this.isOtherSelected;
textarea.required = this.isOtherSelected;
textarea.disabled = false;
if (this.isOtherSelected) {
textarea.setAttribute('required', 'required');
} else {
textarea.removeAttribute('required');
}
}

this.updateSubmitDisabled();
Expand Down

0 comments on commit 70acaee

Please sign in to comment.