I'm attempting to add Javascript to survey items that I've imported from a Simple Format Text File, but Qualtrics doesn't recognize the Javascript when applied to these items. Is there something that I need to enable when importing survey items?
I begin by uploading the item to a new Qualtrics survey.
Here is the survey item:
JS Test.txtI set the Embedded Data at the top of the Survey Flow:
I add the Javascript to that survey item:
Qualtrics.SurveyEngine.addOnload(function()
{
var itemText = "${q://QID2/QuestionText}";
Qualtrics.SurveyEngine.setEmbeddedData( 'TestItem', itemText );
});
I add a new item that should display the JavaScript (Question Text from the item):
But when I preview the survey, the field is blank.
However, if I add the same exact JavaScript to a different item in the same survey that I did not import from a Text file (changing only the QID), it works perfectly.
Can JavaScript not be added to imported survey items?
Which question is QID2? If you pipe ${q://QID2/QuestionText} into the question text of the question than has the JS attached, is it non-blank?
Yes, it's a non-blank (it contains the item text). Here's a copy of the qsf file with the piping, the javascript for the item that was entered manually and the item that was imported from a plain text file. The QID for the imported item is QID4 and the QID for the manually written item is QID1.
JS_Test2.qsf
Update: It's an internal error on Qualtrics' end. Engineering is attempting to resolve it.
Second update: Engineering won't look into it because they don't assist with custom code, so it may not be possible to add JavaScript to items that are imported from a Plain Text file. If anyone finds otherwise, please reach out!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.