Hi!
I want to a create a variable based on responses to a set of statements in a matrix table. I am trying to do this by using the following. But this does not work. Anyone know of a different way? For example, using this.getChoiceRecodeValue(this.getSelectedChoices()); syntax? I don't know how to modify this for the matrix table.. thanks for any help!
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var paydec = "${q://QID94/SelectedAnswerRecode/3}";
if (paydec==="1"){
part2pay = 1.00;
}
else {
part2pay=0.40;
}
Qualtrics.SurveyEngine.setEmbeddedData("part2pay", part2pay);
Page 1 / 1
Use the below code:
This code checks if row choice 3 and answer col 2 is selected then if condition is true. Similarly you can change the row and column number and add logic accordingly.
Qualtrics.SurveyEngine.addOnPageSubmit(function(type)
{
if(type == "next")
{
var part2pay;
if(this.getChoiceValue(3,2)){
part2pay = 1.00;
}
else {
part2pay=0.40;
}
Qualtrics.SurveyEngine.setEmbeddedData("part2pay", part2pay);
}
});
Thanks so much! This works perfectly!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.