我让 Qualtrics 使用 setChoiceValueByRecode Javascript 从嵌入式数据字段自动填充问题选择。我已经能够成功地解决单选和多选多项选择问题,但无法解决矩阵问题。
下面是一个使用 ( recodeValue [subID] value ) 的多项选择题的示例,没有 subID,因为多项选择题不需要它:
Qualtrics.SurveyEngine.addOnload(function()
{
var answer = "${e://Field/DEMOGRAPHICs_Gender}";
var that = this;
switch(answer){
case "Male":
that.setChoiceValueByRecodeValue(1, true);
break;
case "Female":
that.setChoiceValueByRecodeValue(2, true);
break;
case "Non-binary":
that.setChoiceValueByRecodeValue(3, true);
break;
case "Prefer not to answer":
that.setChoiceValueByRecodeValue(4, true);
break;
default:
break;
}
});
documentation from Qualtrics围绕这一点表明,对于矩阵,我需要指定一个 [subID] 来通知要引用矩阵的哪一行,但是我无法弄清楚这个 [subID] 是什么或在哪里可以找到它。
例如对于 this question ...我尝试使用“Amazon”作为 subID,但没有成功。有任何想法吗?
最佳答案
subID(第二个参数)是答案的重新编码(如果矩阵未转置则为列)。 id(第一个参数)是选择 id(如果矩阵未转置则为行)。因此,选择第一行和第一列可能如下所示:
this.setChoiceValueByRecodeValue(1, 1, true);
关于javascript - 如何为 Qualtrics 中的矩阵问题为 setChoiceValueByRecodeValue 编写 Javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51448744/