auto-punching from a multi select question to a single select question, when only one response is selected on the multi-select question. | XM Community
Skip to main content

how do you use javascript in Qualtrics to auto-punch a response from a multi-select question (called Q1) when only one response is selected on Q1 to the next question (called Q2. Q2 is single select multiple choice question which displays those responses select in Q1).

Check how many choices are displayed, and if there is only one select it.

Qualtrics.SurveyEngine.addOnReady(function() {
var choices = this.getChoices();
if(choices.length==1) {
this.setChoiceValue(choices.pop(),true);
this.clickNextButton();
}
});

 


Thank you so much TomG. Works great. However, it is auto-punching and then going immediately to the following question. Is there java script that can be added so that respondent needs to select either next or back? Thanks again so much

 


Thank you so much TomG. Works great. However, it is auto-punching and then going immediately to the following question. Is there java script that can be added so that respondent needs to select either next or back? Thanks again so much

 

Remove:

this.clickNextButton();

 


Thank you so much Tom!!! You have been the best part of my day. Unfortunately, that is not a good statement about my day. I really appreciate your help. Best,

 


One more question, Tom. I am guessing this code would not work for a matrix table (Table 1) in which you must select at least one response per row (three columns in the matrix table and 7 rows, more than one response per row allowed) and auto-punch the following matrix table (Matrix table 2, again 3 by 7 columns by rows), if only one row is selected in the first matrix table. The auto-punching would have to allow for multiple responses on that one row. I owe you one, Tom. Thanks again! Karen


Correct, it doesn’t make sense for a matrix. It does make sense for these other types of follow-up questions:

  • Constant Sum

  • Rank Order

  • Pick, Group, and Rank with one group

But the JS code would be different.


Thanks Tom. I appreciate it. Would you be able to provide the JS code as that is what is being requested of me. If too much a hassle, I understand. Best,


You don’t need JS for this. Set the embedded data for the first question if single choice is selected.

And use the same embedded data, to capture what they selected in Q2.


Thank you. Can you do this same logic with a matrix table, where the matrix table requires at least one response per row and you want to auto-punch if only one row is selected on the first matrix table? Thanks,


You don’t need JS for this. Set the embedded data for the first question if single choice is selected.

And use the same embedded data, to capture what they selected in Q2.

There are a bunch of reasons why this approach isn’t as desirable or efficient as auto punching a follow-up question, including:

  1. Subsequent survey logic
  2. Subsequent survey piping
  3. Data reporting and analysis

Thank you!


Leave a Reply