Skip to content

KG - Fix Survey Question Validation When Dependent on Option Selection#299

Merged
Stuart-Johnson merged 8 commits intomasterfrom
kg-survey_question_validation
May 30, 2017
Merged

KG - Fix Survey Question Validation When Dependent on Option Selection#299
Stuart-Johnson merged 8 commits intomasterfrom
kg-survey_question_validation

Conversation

@kayla-glick
Copy link

Pivotal Story:
https://www.pivotaltracker.com/story/show/146091507

Feature:
When surveys had questions which were both required and dependent on another option, if that question wasn't filled out, despite the depender option not being selected, it would fail validations. Instead, if the depender option isn't selected, it should ignore validations on the question.

Fix:
Because the presence validation is run pre-save, I didn't have access to the other question responses that I needed to check whether the option was selected. Instead, I had to use an after_save callback to apply errors if the use-case was met, then check for those errors in the controller.

@Stuart-Johnson Stuart-Johnson merged commit 8ea55ef into master May 30, 2017
@Stuart-Johnson Stuart-Johnson deleted the kg-survey_question_validation branch May 30, 2017 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants