Hi Qualtrics users,
I'm working on a project with lots of branching, which will determine which descriptive text questions will be shown to each survey respondent. I'd like to help survey respondents keep track of the descriptive text they've read by including a summary page: however, I want this summary page to show only that descriptive text which that survey respondent has actually seen. (For example, choice 1 leads to either Text1 or no Text1, choice 2 leads to either Text2 or no Text2, choice 3 leads to either Text3 or no Text3. At the end, if the respondent chose text for Choice 1 and 3 but not for Choice 2, I want only Text1 and Text3 to show in the summary.)
I originally thought that Qualtrics already did this: that the survey would only show piped text if the respondent had viewed that text in the current survey. However, it seems I was wrong. I am therefore looking for some custom code alternatives.
Does anyone have any suggestions for how to approach this problem?
My current plan is to see if I can create an embedded data field for the summary, and update it to append the additional text items as they appear. I'm unsure whether I'll have control over formatting in this case (ideally, each Text should be its own list item or paragraph). I'm not an expert, so it'll take me some time to see if this works. Any guidance or helpful suggestions would be most appreciated. Thanks!
Solved
Cumulative list of descriptive text questions shown
Best answer by ahmedA
Add this JS to every question text that you want to collect.
I suggest initializing the variable
shownin the survey with a few spaces, otherwise you'll see a
nullat beggining.
Qualtrics.SurveyEngine.addOnReady(function () {
let shown = Qualtrics.SurveyEngine.getEmbeddedData("shown");
let new_text = shown + "
" + this.getQuestionTextContainer().innerText;
Qualtrics.SurveyEngine.setEmbeddedData("shown", new_text);
});
This only execute when the question is displayed, therefore it will only capture the relevant text. If you'd like to capture more than one text from the same page, then the logic will get a little complicated.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
