Question T4366
Visible to All Users

Skip pages or questions that have already been answered

created 5 years ago

After a user has gone through the survey we give them an option to go back to the first page and select more questions to answer. If the user goes back and selects new questions to answer we don't want them to have to navigate back through the pages that they have already visited.

I have tried implementing this a few ways using survey.onCurrentPageChanging but this isn't working and ends up in a recursive loop. I feel like I am probably missing an obvious way to do this. I've considered visibleIf and isVisible but this creates issues with other logic we have implemented.

For example:

JavaScript
survey.onCurrentPageChanging.add((sender, options) => { if (options.newCurrentPage.hasShown) sender.nextPage() })

Here is an example plunkr https://plnkr.co/edit/nhjFkYQysTGU0UE4

Steps to reproduce:

1.) Select "general pain"
2.) Answer questions
3.) On the last screen click the "Add symptoms" button.
4.) Select "abdominal pain"
5.) User is taken to the "general pain" questions which have already been answered

The desired outcome is that any pages or questions previously answered are not show to the user again.

Thank you. Appreciate your time.

Answers approved by surveyjs Support

created 5 years ago

Hello,
I am getting an error: "Uncaught ReferenceError: canOnlyFireOnce is not defined" on clicking the "Add symptoms".

You can use the visibleIf expression for this question: visibleIf: "{generalPainSeverity} empty" - it will show the question only if a question is not answered.

Thank you,
Andrew
SurveyJS Team