Reducing time delay and smoothing transition on skipped questions | XM Community
Skip to main content

Hi ! 

In my survey, I have a block of questions with the following structure: Q1, Q2, Q3, Q4

for the first iteration of my Loop, I wanted certain questions to appear (Q1 and Q2) and then to skip directly to another one (Q5). Then, for the second iteration onwards, i wanted questions to appear (Q2 and Q4), skipping Q1 and Q2, which should only appear in the first iteration, and going directly to Q5. 

I managed to do it with the following JS:

JS in Q2 and Q2: 

Qualtrics.SurveyEngine.addOnload(function() {

if("${lm://CurrentLoopNumber}" != "1")jQuery("#"+this.questionId).hide();
if("${lm://CurrentLoopNumber}" != "1")jQuery("#Buttons").hide();

});

Qualtrics.SurveyEngine.addOnReady(function()
{
if("${lm://CurrentLoopNumber}" != "1")jQuery("#Buttons").hide();
if("${lm://CurrentLoopNumber}" != "1")jQuery('#NextButton').click();

});

 

JS for Q3 and Q4:

Qualtrics.SurveyEngine.addOnReady(function() {
    // Check if the loop number is 1 (first iteration)
    if(parseInt("${lm://CurrentLoopNumber}", 10) === 1) {
        // Hide the question container
        jQuery("#"+this.questionId).hide();
        // Hide the navigation buttons
        jQuery("#Buttons").hide();
        // Automatically click the 'Next' button to advance to the next question
        jQuery('#NextButton').click();
    }
});

 

The problem is that i can clearly see the jumps of questions in the survey. I changed the Look and Feel to Page transition: Fade, but there is still a noticeable jump, and a time delay between the questions that appear. 

Is there a way to fix this so that respondents don’t notice?

Thank you!!!

@luciadome - Maintain your own current loop number embedded data field and use it in display logic for Q1 through Q4. 

Initialize it in the survey flow before the loop: cln = 1

Then increment it in JS at the end of the loop (Q5):

Qualtrics.SurveyEngine.setEmbeddedData("cln",Number("${e:/Field/cln")+1);

 


thank you @TomG !! The thing is that Q5 is a question that appears only 6 times in the loop, it is based off another embedded data. Thus, if I set this JS at the end of the loop (Q5), it may only work the 6 times that Q5 appears. Do you know how I can solve this? 


thank you @TomG !! The thing is that Q5 is a question that appears only 6 times in the loop, it is based off another embedded data. Thus, if I set this JS at the end of the loop (Q5), it may only work the 6 times that Q5 appears. Do you know how I can solve this? 

You can put the cln update in multiple questions. It just has to update after the pages that use it in displayed logic have loaded. For example, you could do it in the addOnPageSubmit functions of Q2 and Q4.


Leave a Reply