I have a question in nps which goes from 0 to 10 in my question 1 "Q1". I created a second question without using display logic so that if I put in q1 between 0 to 6 it displays me in a paragraph "sorry", 7 to 8 "good" and 9 to 10 "very good " with js code but it's the first time I'm using it and I'm a little lost. Thank you very much for your help.
Sincerely
Best answer by Nam Nguyen
Good morning,
I have a question in nps which goes from 0 to 10 in my question 1 "Q1". I created a second question without using display logic so that if I put in q1 between 0 to 6 it displays me in a paragraph "sorry", 7 to 8 "good" and 9 to 10 "very good " with js code but it's the first time I'm using it and I'm a little lost. Thank you very much for your help.
Sincerely
Add this to your 2nd question text richcontent editor → source
div id="messageDisplay"></div>
Add this JS to the 2nd question
Qualtrics.SurveyEngine.addOnload(function() { var npsScore = parseInt("${q://QID1/ChoiceGroup/SelectedChoices}"); var message = "";
var messageElement = document.getElementById("messageDisplay"); if (messageElement) { messageElement.innerHTML = message; } });
Note: I’m assuming Id of Q1 is QID1 so please check if ${q://QID1/ChoiceGroup/SelectedChoices} pull out the correct Q1 value and change it if necessary.
You could create three different questions with display logic for each where if 0-6 is selected, it displays “sorry,” if 7-8 is selected, it displays “good.”
I have a question in nps which goes from 0 to 10 in my question 1 "Q1". I created a second question without using display logic so that if I put in q1 between 0 to 6 it displays me in a paragraph "sorry", 7 to 8 "good" and 9 to 10 "very good " with js code but it's the first time I'm using it and I'm a little lost. Thank you very much for your help.
Sincerely
Add this to your 2nd question text richcontent editor → source
div id="messageDisplay"></div>
Add this JS to the 2nd question
Qualtrics.SurveyEngine.addOnload(function() { var npsScore = parseInt("${q://QID1/ChoiceGroup/SelectedChoices}"); var message = "";
var messageElement = document.getElementById("messageDisplay"); if (messageElement) { messageElement.innerHTML = message; } });
Note: I’m assuming Id of Q1 is QID1 so please check if ${q://QID1/ChoiceGroup/SelectedChoices} pull out the correct Q1 value and change it if necessary.