Solved
Using Javascript to punch into another question
Hello
This is probably a very basic question, but I've been trying for ages and can't get it to work. I'm trying to copy the answers from Multi question QID73 into duplicate question QID76 (where this javascript is stored), but it's not working. It does seem to work if I select one answer, which leads me to think I need to use different syntax for a multi question? I've tried it without the variable, and without the loop, but nothing works. Any suggestions?
var valQ10 = "parseInt(${q://QID73/SelectedChoicesRecode})";
for (var i = 1; i <= 12; i++)
{
if (valQ10==i)
{ this.setChoiceValueByRecodeValue(i,true); }
}
Thanks!
Best answer by TriciaB
Thanks for the tip. I've done it like this, which seems to work. :)
var valQ10 = "${q://QID73/SelectedChoicesRecode}";
var arrQ10 = new Array();
arrQ10 = valQ10.split(",")
for(var i=0;i<arrQ10.length;i++)
{
for (var j = 1; j <= 12; j++)
{
if (arrQ10[i]==j)
{ this.setChoiceValueByRecodeValue(j,true); }
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
