Anyone who can help with the javascript? I need to autocode the 3rd question based from my responses in Rank Order questions. Below is the link for reference.
https://rochediacx.fra1.qualtrics.com/jfe/preview/SV_6zmQqumcohFkWa2?Q_CHL=preview&Q_SurveyVersionID=current
Page 1 / 1
Hi there,
this could solve your problem :-)
- create an embedded data field selectedItemsRankingQuestion
- add the below code into the JS for the ranking question
- add the below code in the ranking question
Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
let inputs = document.getElementsByTagName('input')
let selectedItemsRankingQuestion = new Array;
console.log(inputs)
for(let i=0;i
selectedItemsRankingQuestion.push(inputs[i].id.split('~')[2])
}
}
console.log(selectedItemsRankingQuestion)
Qualtrics.SurveyEngine.setEmbeddedData("selectedItemsRankingQuestion", selectedItemsRankingQuestion.join(','));
});
then add this code in the multi-select question:
Qualtrics.SurveyEngine.addOnload(function()
{
let selectedItemsRanking = "${e://Field/selectedItemsRankingQuestion}".split(',')
for(let i = 0;i
}
});
note that the recodes for these two questions have to be identical respectively that the recodes of the auto coding question are identical with the last element of options' ids in the ranking question
Best regards
Rudi
Rudi Thanks you, it worked. But after adding some questions, the auto coding question selects all the options.
https://rochediacx.fra1.qualtrics.com/jfe/preview/SV_6zmQqumcohFkWa2?Q_CHL=preview&Q_SurveyVersionID=current
Hi, I think the easiest way would be to add page breaks. Minimum would be before and after the ranking question and before and after the hidden question. Side note: Page breaks are also better for mobile devices because they avoid scrolling for the respondents
Best regards
Rudi
Thanks for that Rudi . I'll suggest that to our client. Thanks again.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.