Hi there
I need your help for a a beginner's question.
I just want to get each selected choice (recoded by variable name) in a unique value (separated by a comma). I'm blocked at the end of my loop, when I want to create the "mods" variable.
Can you help me please ? Here is my code :
Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
/*Place your JavaScript here to run when the page is submitted*/
var arr = this.getSelectedChoices();
if(arr.length > 0) {
for(var i = 0;i
}
}
alert("Recode Value: " + mods);
});
Thank you very much,
JR
Hi there,
Is there anybody can help me ?
I'm still blocked since one month... :(
If I understand correctly, you want mods to be a comma separated list of variable names:
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var modsArr = ];
var arr = this.getSelectedChoices();
if(arr.length > 0) {
for(var i = 0;i
}
}
var mods = modsArr.join(",");
alert("Variable names: " + mods);
});
Thank you so much TomG, you totally understood my issue : ))
Thanks
In my drop down I have, Hotelname, recode, variable naming
Hotel1, Hotel Full Name1, H1
Hotel2, Hotel Full Name2, H2
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var modsArr = m];
var arr = this.getSelectedChoices();
if(arr.length > 0) {
for(var i = 0; i < arr.length; i++) {
modsArr.push(this.getChoiceVariableName(arrli]));
}
}
var mods = modsArr.join(",");
alert("Variable names: " + mods);
});
Now that the code is working when I select Hotel2 in the list and submit the page I am able to record H2 in an embedded field. So all is good! :)
Thanks
Rod Pestell
I think the community updates ate the < and > symbols.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.