diff --git a/src/domain/entities/Questionnaire/QuestionnaireQuestion.ts b/src/domain/entities/Questionnaire/QuestionnaireQuestion.ts index f9ad542..67e2b50 100644 --- a/src/domain/entities/Questionnaire/QuestionnaireQuestion.ts +++ b/src/domain/entities/Questionnaire/QuestionnaireQuestion.ts @@ -238,6 +238,7 @@ export class QuestionnaireQuestion { const updatedErrors = this.getQuestionWarningsAndErrors(question, rules); if (question.isVisible !== updatedIsVisible) { + //If a question is hidden, reset its value return { ...question, isVisible: updatedIsVisible, diff --git a/src/domain/entities/Questionnaire/QuestionnaireSection.ts b/src/domain/entities/Questionnaire/QuestionnaireSection.ts index 7b4c20c..151be36 100644 --- a/src/domain/entities/Questionnaire/QuestionnaireSection.ts +++ b/src/domain/entities/Questionnaire/QuestionnaireSection.ts @@ -57,8 +57,7 @@ export class QuestionnaireSectionM { : section; if (section.isVisible === false && updatedSection.isVisible === true) { - //reset all questions in the section - + //reset all questions in the section that was hidden const resetQuestions = section.questions.reduce((acc, hiddenQuestion) => { return QuestionnaireQuestion.updateQuestions( section.questions,