Instead of duplicating a question and adding display logic to display either one depending on whether or not an embedded data field is empty, I'd like to just have javascript dynamically change the question text depending on whether or not the embedded field is empty. I've already proven I can do this by duplicating the question and adding display logic to display either one based on whether or not a person's last name is empty (after setting the embedded data after my authentication piece). I would just rather have a single question in my response output.
So far I have:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var text = jQuery("#"+this.questionId+" .QuestionText")
var lastname = "${e://Field/LAST_NAME}";
if(!!lastname)
text.html("We DONT HAVE your last name")
Else
text.html("We have your last name")
});
I've also tried variations on the logic to check for the null value (e.g. lastname === "", lastname is null, etc.), but I can't seem to make it work.
Best answer by ahmedA
View original