How can I hide a block in response summary? | XM Community
Solved

How can I hide a block in response summary?

  • 11 June 2021
  • 5 replies
  • 296 views

Hey, I am trying to find a custom code that would allow me to hide/ exclude a particular block from response summary? Can you help me with a custom JS code?

icon

Best answer by ahmedA 20 May 2023, 00:16

View original

5 replies

Userlevel 7
Badge +21

Add this EVERY question in the block:
Qualtrics.SurveyEngine.addOnload(function () {
    let qc = this.questionContainer;
    if (document.querySelector("#EndOfSurvey")) {
        qc.style.display = "none";
    }
});

https://www.qualtrics.com/community/discussion/comment/38320#Comment_38320Hello ahmedA thank you for your response. Code works like a charm. However, it seems to work on all questions in a certain block but not in the other block. Anything that I need to be mindful of while using this code?

UPDATE: after a lot of hit and trial, I realized that this code does not work for questions on the last page. My last block had no page breaks so code didnt work on any of those questions, but when I added a page break before the last question it has magically started to work on all questions except last.

ahmedA is it something you can look at? Again thank you for helping me with this lovely solution.

Userlevel 7
Badge +21

I don't know why this is happening. The code works at the question level, so irrespective of how many questions you have on the page/block, it should work.
It basically checks for the "EndOfSurvey" element, which ONLY comes when they are viewing the report.
Perhaps you could look at the implementation once agian.

Userlevel 7
Badge +21

Updating this response, as it appears that something has changed at the End of Survey page:

Add this to every question you want to hide from the response summary.

Qualtrics.SurveyEngine.addOnReady(function () {
const quest = this;

if (document.querySelector("#EndOfSurvey")) {
document.querySelector("#" + quest.questionId).style.display = "none";
}
});

 

Leave a Reply