0

I am trying to use Qualtrics if anyone is familiar with the program for a survey and I am embedding JavaScript in order to score some of the questions in a specific manner.

The problem I have is that I am trying to connect a string with operators but it fails to do so but when I try it in a different editor the string operators work fine.

Code:

alert("${q://QID5/SelectedAnswerRecode/1}");

which alerts the value,

alert("${q://QID5/SelectedAnswerRecode/" + 1 + "}");

this alerts an empty text box.

Note: alert("Hello" + " World"); works fine when I use this/

So if there is anyone who knows Qualtrics and knows why it does this or any other methods this would be a help.

  • What you're describing isn't really related to JavaScript. `"${q://QID70/SelectedAnswerRecode/" + 1 + "}"` and `"${q://QID70/SelectedAnswerRecode/1}"` are identical, JavaScript cannot tell them apart. I'm guessing Qualtrics is doing some kind of pre-processing on `"${...}"`, in which case you can't dynamically build strings that way. You're building a string in JavaScript, which (presumably) only runs *after* whatever preprocessing step Qualtrics performs. – user229044 Sep 15 '14 at 13:57
  • Ok thanks, that would make sense then. I was only curious why it didn't work with Qualtrics. I appreciate the insight! – user3673288 Sep 15 '14 at 14:14

0 Answers0