I currently have the following structure:
Randomizer (randomly present 4 of 4)
Group ABC
Group DEF
Group GHI
Group JKL
Preceding every "group," I'd like something that says:
Part 1
Part 2
Part 3
Part 4
Or, for example:
Part 1
Group DEF
Part 2
Group ABC
Part 3
Group JKL
Part 4
Group GHI
And here's another example:
Part 1
Group GHI
Part 2
Group GHI
Part 3
Group DEF
Part 4
Group ABC
Page 1 / 1
Hi there, one way this can be put in place is by using JavaScript to update an HTML element to display a number that gets incremented each time the Part Number page advances.
To give it a try, first head to the Survey Flow and create an Embedded Data element at the top of the Survey Flow. Create a field called "Part" and set its value to "1", like in the below:
Next, back in the Builder, add a Text/Graphic question to the top of each of the 4 Blocks. Using the Rich Content Editor's HTML/Source view "<>", update the question text for each with the below:
Part 0
Then, update the JavaScript for each of these Text/Graphic questions with the below:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
var partnum = parseInt("${e://Field/Part}");
document.getElementById("partnum").innerHTML=partnum;
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var partnum = parseInt("${e://Field/Part}");
partnum=partnum+1;
Qualtrics.SurveyEngine.setEmbeddedData('Part', partnum);
});
When the page loads, the HTML element will display whatever the value of the Embedded Data field "Part" is. Then, when the page advances, the value of this Embedded Data field gets updated by 1.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.