Is there a way to use Embedded Data with In-page Display Logic (or similar work-around)? | XM Community
Skip to main content
Solved

Is there a way to use Embedded Data with In-page Display Logic (or similar work-around)?


MatthewM
Level 6 ●●●●●●
Forum|alt.badge.img+30
  • Level 6 ●●●●●●
  • 1069 replies
I have a page in a survey with four questions. The first three questions apply to all respondents, but the fourth question does not apply to members of specific groups (who are identifiable in the Embedded Data), so I want to hide it from those respondents. The catch is that I'd prefer the fourth question to stay on the same page as the first three, not be on a page by itself. This requires that I use the In-page option in Display Logic, but that only works with questions, not embedded data. I thought I could work around that by piping the Embedded Data to a text question on this page that I used Display Logic to always hide (because I don't want to run the risk of a curious respondent modifying the piped values), but I have learned the hard way that piping only works when the target question is visible. Is there some clever way to make this happen that I'm not seeing?

Best answer by MohammedAli_Rajapkar

Hi @MatthewM, Is there a "descriptive text" or any page shown before this 4 questions page? If yes, then you can have a hidden "text question" on any previous page and capture the embedded data value into that "text question" and then use the value of that "text question" to apply in page display logic. You would have to find out the question id for that "text question" by using inspect feature and then add the code in the onload section of JavaScript: jQuery("#id_of_Question_to_hide").css("display","none")
View original

6 replies

MohammedAli_Rajapkar
QPN Level 5 ●●●●●
Forum|alt.badge.img+20
Hi @MatthewM, Is there a "descriptive text" or any page shown before this 4 questions page? If yes, then you can have a hidden "text question" on any previous page and capture the embedded data value into that "text question" and then use the value of that "text question" to apply in page display logic. You would have to find out the question id for that "text question" by using inspect feature and then add the code in the onload section of JavaScript: jQuery("#id_of_Question_to_hide").css("display","none")

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5926 replies
  • April 17, 2018
An easier way to hide a question with JavaScript (no need to look up an id) is: ``` jQuery("#"+this.questionId).hide(); ```

rjpmenon
Forum|alt.badge.img+1
  • 16 replies
  • August 19, 2021

Thank you for this solution! This works great!!


rjpmenon
Forum|alt.badge.img+1
  • 16 replies
  • August 19, 2021

While adding the Javascript to the question to hide it worked, it left me with an unintended consequence. There is a line for each question that's hidden. I can convince my survey requestor to ignore these lines (5 lines from 5 hidden questions), but was wondering if anyone knows of a way to get rid of them? Thank you!!
image.png


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5926 replies
  • August 19, 2021

Add this to the JS of each hidden question:
Qualtrics.SurveyEngine.addOnReady(function() {
jQuery("#"+this.questionId).next(".Separator").hide();
});


rjpmenon
Forum|alt.badge.img+1
  • 16 replies
  • August 19, 2021

Thank you so much, Tom!!!


Leave a Reply