Is it possible have back button send participant back 2 pages? | XM Community
Skip to main content

Hi! I have a question that is hidden and has page breaks on both ends, like so:
Question 1
Page break 1
Question 2 (Hidden using code below)
Page break 2
Question 3

This works great when you are moving forward through the survey. However, if you want to move backward, from Question 3 to Question 1, you're not able to. You end up going back to Question 2 which automatically sends you forward to Question 3. Is there any way for respondents to be able to go back from Question 3 to Question 1 if they want? For example, can the back button send a participant back 2 pages, instead of just one? (Note: The JS below is copied from various searches. I don't know JS yet.) Thanks!!!!

Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId).hide();
jQuery('.QuestionOuter').css('visibility','hidden')
jQuery('#Wrapper').css('visibility','hidden');
jQuery('#Wrapper').css('opacity','0');
});

Qualtrics.SurveyEngine.addOnReady(function() {
jQuery('#NextButton').click();
jQuery('#Wrapper').css('visibility','hidden')
});

Add this to the top (outside all the Qualtrics....) of your JS in the first question.

var double_back;

Change the onReady method of the second question to this:
Qualtrics.SurveyEngine.addOnReady(function () {
if (double_back) {
double_back = 0;
jQuery("#PreviousButton").click();
} else {
jQuery("#NextButton").click();
}

jQuery("#Wrapper").css("visibility", "hidden");
});
Add this to your third question JS:
Qualtrics.SurveyEngine.addOnReady(function () {
jQuery("#PreviousButton").click(function () {
double_back = 1;
});
});


That worked perfectly. Thanks so much!!!!


So what I am reading here is that to enable a participant to even go back one question requires changing the code. Is that correct? That is, for non-programmers there is no way you can go back to see a previous answer even if it was the one before, unless it is on the same page where you can scroll. Would the solution for non-programmers be to remove all page breaks?


Leave a Reply