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
Solved
Autocode the next question based from the response in ranking order
Best answer by Rudi
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
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
