Autopopulate a multiple response question from a previous multiple question | XM Community
Skip to main content

I would have thought this would be a common question as hidden questions are common in other platforms in driving a survey. However, I couldn’t find a post on this so just in case anyone wants to know how to do it in Javascript. Would be useful to know how it is done in Qualtrics without Javascript.

 

    const QB = "${q://QID9/SelectedChoicesRecode}"; //read answers from multiple response question
    var result = QB.split(', ');  // convert the string answers into an array where the comma and space is the delimiter eg. “1, 2” into “1”,”2”]
    
    if (result.includes("1")) //search in the array for code 1
    {         

                 //check the first box in a multiple response
                jQuery('inputptype="checkbox"]').eq(0).prop('checked',true);        
    }
    if (result.includes("2")) ) //search in the array for code 2
    {          

                //check the second box in a multiple response
                jQuery('input type="checkbox"]').eq(1).prop('checked',true);    
    }

You can use carry forward and Default choices options. if the same options list are there.


I should add how to hide the question since I mentioned it although this commented on other posts. But right in saying that this has the flexibility if the codeframes are different between the two questions.

 

this.getQuestionContainer().hide();
        this.hidePreviousButton();
        this.hideNextButton();
        this.clickNextButton(); 


You can use carry forward and Default choices options. if the same options list are there.

Hmm I tried it but this didn’t seem to work the Default just came up blank. Perhaps embedded data is a way to go? Although I don’t know how to do it for multiple answers.


Leave a Reply