Q1. Displays a random number from 1 to 10. I figured this out!
Q2. Select the number from 1 to 10.
Q3. Displays selected number and points earned.
Points Earned is 10 if selected number = random number. If not 10, it’s the difference of selected number - random number.
I tried using JavaScript, Piped Text, Embedded Data but it doesn’t work.
JavaScript for Question 2.
Qualtrics.SurveyEngine.addOnload(function() {
// Get the value of the selected radio button in Question 2
var selectedNumber = jQuery("#"+this.Q2+" inputQtype='radio']:checked").val();
console.log("Selected Number: " + selectedNumber);
// Set the "SelectedNumber" embedded data field to the captured value
Qualtrics.SurveyEngine.setEmbeddedData('SelectedNumber', selectedNumber);
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
Defined Embedded Data
SelectedNumber
Inserted Piped Text in Q3 - Your selected number was ${e://Field/SelectedNumber}
Doesn’t work. I can’t even display the SelectedNumber let alone calculate the points. Please help!