Need to hide and show a question based from the previous responses | XM Community
Skip to main content

I need to show a hidden question based from the previous responses and Embedded data. I have here a javascript but it isn't working since the question is always shown though the condition wasn't met. I'm not sure what is wrong with the condition.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

//jQuery("#"+this.questionId+" .QuestionText").html("Hello everybody");

var csat1 = "${q://QID99/ChoiceNumericEntryValue/1}";
var csat2 = "${q://QID108/ChoiceNumericEntryValue/1}";

var ces1 = "${q://QID98/ChoiceNumericEntryValue/1}";
var ces2 = "${q://QID107/ChoiceNumericEntryValue/1}";

var pc = "${e://Field/PrimaryCountry}"

console.log(csat1);
console.log(csat2);
console.log(pc);

jQuery("#"+this.questionId).hide();
if ((csat1 <= 3 || csat2 <= 3) || (ces1 <= 3 && pc != "Canada") || (ces2 <= 3 && pc != "Canada")){
jQuery("#"+this.questionId).show();
}else {
jQuery("#"+this.questionId).hide();
}
});

Why can't you use display logic available in the tool and set the conditions of the Embedded data in the Survey Flow?


Leave a Reply