我正在Qualtrics设计一项调查。 每个问题有多个选择答案,5个固定和8个随机,5个多项选择将是恒定的并且一直呈现。 我将从8个随机选择中只选择一个选项来呈现5个常数选择,因此总共多个选项将呈现为6.最后,我需要在嵌入数据字段中捕获8个随机选择的关联有5个固定的选择。 我发现这个代码并且它工作得很完美但到目前为止它捕获了选择的ID。 但是,我需要捕获项目的标签名称而不是ID。
//get the div containing the choices, then get all input child elements of that div var choices = this.getChoiceContainer().getElementsByTagName("input"); //initialize an array for the IDs of the choices var choiceIDs = [] //add the ID of each choice to the array for (var i=0; i < choices.length; i++) { choiceIDs.push(choices[i].id); } //get the current choice order from embedded data and add this loop to it. //Add a | to distinguish between loops. var choiceOrder = "${e://field/choiceorder}" + choiceIDs.toString() + "|"; //set the embedded data with the new value Qualtrics.SurveyEngine.setEmbeddedData("choiceorder", choiceOrder);I am designing a survey in Qualtrics. each question has multiple choice answers, 5 fixed and 8 random, the 5 multiple choices will be constant and render all the time. I'll throw only one choice out of the 8 randomize choices to be presented with the 5 constant choices, so total multiple choices will be render is 6. Finally I need to capture in the embedded data field which choice of the 8 random was associated with the 5 fixed choices. I found this code and it works perfect But so far its capturing the IDs of the choices. however, I need to capture the label name of the item instead of the IDs.
//get the div containing the choices, then get all input child elements of that div var choices = this.getChoiceContainer().getElementsByTagName("input"); //initialize an array for the IDs of the choices var choiceIDs = [] //add the ID of each choice to the array for (var i=0; i < choices.length; i++) { choiceIDs.push(choices[i].id); } //get the current choice order from embedded data and add this loop to it. //Add a | to distinguish between loops. var choiceOrder = "${e://field/choiceorder}" + choiceIDs.toString() + "|"; //set the embedded data with the new value Qualtrics.SurveyEngine.setEmbeddedData("choiceorder", choiceOrder);最满意答案
你不需要JavaScript。 您可以将显示的选项通过管道传输到测量流程中的嵌入变量中:
choiceorder = ${q://QIDxx/ChoiceGroup/DisplayedChoices}You don't need JavaScript for this. You can just pipe the displayed choices into an embedded variable in the survey flow:
choiceorder = ${q://QIDxx/ChoiceGroup/DisplayedChoices}使用javascript在Qualtrics中记录随机选择的答案标签(Record answer label of the choice for randomization in Qualtrics using javascript)我正在Qualtrics设计一项调查。 每个问题有多个选择答案,5个固定和8个随机,5个多项选择将是恒定的并且一直呈现。 我将从8个随机选择中只选择一个选项来呈现5个常数选择,因此总共多个选项将呈现为6.最后,我需要在嵌入数据字段中捕获8个随机选择的关联有5个固定的选择。 我发现这个代码并且它工作得很完美但到目前为止它捕获了选择的ID。 但是,我需要捕获项目的标签名称而不是ID。
//get the div containing the choices, then get all input child elements of that div var choices = this.getChoiceContainer().getElementsByTagName("input"); //initialize an array for the IDs of the choices var choiceIDs = [] //add the ID of each choice to the array for (var i=0; i < choices.length; i++) { choiceIDs.push(choices[i].id); } //get the current choice order from embedded data and add this loop to it. //Add a | to distinguish between loops. var choiceOrder = "${e://field/choiceorder}" + choiceIDs.toString() + "|"; //set the embedded data with the new value Qualtrics.SurveyEngine.setEmbeddedData("choiceorder", choiceOrder);I am designing a survey in Qualtrics. each question has multiple choice answers, 5 fixed and 8 random, the 5 multiple choices will be constant and render all the time. I'll throw only one choice out of the 8 randomize choices to be presented with the 5 constant choices, so total multiple choices will be render is 6. Finally I need to capture in the embedded data field which choice of the 8 random was associated with the 5 fixed choices. I found this code and it works perfect But so far its capturing the IDs of the choices. however, I need to capture the label name of the item instead of the IDs.
//get the div containing the choices, then get all input child elements of that div var choices = this.getChoiceContainer().getElementsByTagName("input"); //initialize an array for the IDs of the choices var choiceIDs = [] //add the ID of each choice to the array for (var i=0; i < choices.length; i++) { choiceIDs.push(choices[i].id); } //get the current choice order from embedded data and add this loop to it. //Add a | to distinguish between loops. var choiceOrder = "${e://field/choiceorder}" + choiceIDs.toString() + "|"; //set the embedded data with the new value Qualtrics.SurveyEngine.setEmbeddedData("choiceorder", choiceOrder);最满意答案
你不需要JavaScript。 您可以将显示的选项通过管道传输到测量流程中的嵌入变量中:
choiceorder = ${q://QIDxx/ChoiceGroup/DisplayedChoices}You don't need JavaScript for this. You can just pipe the displayed choices into an embedded variable in the survey flow:
choiceorder = ${q://QIDxx/ChoiceGroup/DisplayedChoices}
发布评论