We often ask multiple choice questions that then drill down into further questions that have carried forward choices from that initial question. For instance, Q1 would ask to select all product users in the home and then Q2 would ask who is the primary product user in the home (carrying forward only selected choices from Q1).
In the case where only 1 choice is made at Q1, I would like to automatically select that response at Q2 and hide it so the respondent doesn't see it.
Here is a snippit of the Javascript I am using to try to accomplish this that isn't working. Essentially saying that if only one choice was selected at the previous question (QID27 in this case) and that choice was X, then select X at this question and skip.
Any thoughts would be appreciated!
Qualtrics.SurveyEngine.addOnload(function()
{
if ("${q://QID27/SelectedChoicesCount}" == 1 && "${q://QID27/SelectedChoicesRecode}" == 1 ) {
this.setChoiceValueByRecodeValue(1, true);
this.getQuestionContainer().hide();
this.clickNextButton();
}
else if ("${q://QID27/SelectedChoicesCount}" == 1 && "${q://QID27/SelectedChoicesRecode}" == 2 ) {
this.setChoiceValueByRecodeValue(2, true);
this.getQuestionContainer().hide();
this.clickNextButton();
}
else if ("${q://QID27/SelectedChoicesCount}" == 1 && "${q://QID27/SelectedChoicesRecode}" == 3 ) {
this.setChoiceValueByRecodeValue(3, true);
this.getQuestionContainer().hide();
this.clickNextButton();
});
Best answer by TomG
View original