Skip to content

Commit

Permalink
fix(surveys): multiple choice survey submit button bug (#822)
Browse files Browse the repository at this point in the history
* fix(surveys): multiple choice survey submit button bug

* use query selector all instead
  • Loading branch information
liyiy authored Oct 4, 2023
1 parent 9f65f91 commit d4d178a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/extensions/surveys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,11 @@ export const createMultipleChoicePopup = (posthog: PostHog, survey: Survey, ques
formElement.addEventListener('change', () => {
const selectedChoices =
singleOrMultiSelect === 'single_choice'
? formElement.querySelector('input[type=radio]:checked')
? formElement.querySelectorAll('input[type=radio]:checked')
: formElement.querySelectorAll('input[type=checkbox]:checked')
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // TODO: Fix this, error because it doesn't recognize node list as an array
if (selectedChoices && (selectedChoices.length ?? 0) > 0) {
if ((selectedChoices.length ?? 0) > 0) {
;(formElement.querySelector('.form-submit') as HTMLButtonElement).disabled = false
} else {
;(formElement.querySelector('.form-submit') as HTMLButtonElement).disabled = true
Expand Down

0 comments on commit d4d178a

Please sign in to comment.