I'm currently putting together a survey on qualtrics using a block with loop and merge functionality. I've encountered an issue where, after the first iteration, the images I'm loading through javascript start disappearing. Although I can briefly see them when the question is loading, they vanish right after.
Can someone help me troubleshoot this problem? What am I missing or doing wrong?
Check out the code snippet below:
Qualtrics.SurveyEngine.addOnload(function()
{
var count = Number("${e://Field/count}");
var dirs = ["sensitive-text", "sensitive-notext", "nonsensitive-text", "nonsensitive-notext"]
var seq = "${e://Field/sequence}";
curStr = seq.split(",")[count]
cur = Number(curStr)
dir = dirs[0];
if (cur >= 100 && cur<200)
{
dir = dirs[1];
}
else if (cur >= 200 && cur < 300)
{
dir = dirs[2];
}
else if (cur>=300 )
{
dir = dirs[3];
}
path = "https://juhu.soic.indiana.edu/rakhasan/picshare/" + dir+"/"+curStr+".jpg";
var img = document.getElementById("img");
img.src=path;
img.style.display = 'block'
img.style.height = '1000px'
img.style.width="700px"
Qualtrics.SurveyEngine.setEmbeddedData("count", count+1) ;
});
The Seq
field contains randomized data for each trial.