Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix: Issue with Conditional Question Options Display #5593

Merged

Conversation

Abishekcs
Copy link
Contributor

#closes #5517

What this PR does

Fix : Issue with Conditional Question Options Display

Cause of the bug :

The bug occurs in the JavaScript code SurveyAdmin.js and the associated Haml file _form.html.haml. When adding options to a dropdown select (this.$conditional_value_select for %select.hidden{"data-conditional-value-select" => ""}), the existing options are not cleared before appending new ones. Consequently, the dropdown retains options from the previous question along with the new ones, leading to unexpected behavior.

To fix this, the solution involves adding the line this.$conditional_value_select.empty(); before adding new options. This ensures that the dropdown is cleared of any previous options, providing a clean slate for the options related to the current question.

Screenshots

Before:

Before.webm

After:

After.webm

@Abishekcs Abishekcs changed the title bug fix: Clear conditional value select before adding options bug fix: Issue with Conditional Question Options Display Jan 23, 2024
@ragesoss
Copy link
Member

LGTM! Nice catch.

@ragesoss ragesoss merged commit bbc9abd into WikiEducationFoundation:master Feb 13, 2024
1 check passed
@Abishekcs Abishekcs deleted the FixConditionalQuestionBug branch February 14, 2024 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with Conditional Question Options Display
2 participants