how to hide a scale point for all statements in a matrix table | XM Community
Skip to main content

how to hide a scale point for all statements in a matrix table


Forum|alt.badge.img+5

Hello,
I have a matrix-type question with 9 scale points. These scale points are piped-text to several other questions however, some of those questions do not require one of the 9 scale points. How do I hide that one scale point for those questions?

11 replies

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • October 7, 2022

sajjid
Would you like to get selected ones from matrix then you can use Carry forward choice.
If there is a requirement of not displaying a few choices statically you can use answer choice display logic of true=false.

Hope it helps!


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • 15 replies
  • October 7, 2022

Hi Deepak,
So, my first question has 9 scales and I'm using Carry forward choice for the questions that follow thereafter. However, some of those questions require only 8 scales. How do I hide one of the scales, especially when the scales are carried forward from the very first question?


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • October 7, 2022

sajjid
You can add a JavaScript on the question which displays carry forward choice to hide that scale point, change the ID and add for as many scale points needed. Something like below:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
document.getElementById('QID67-x2-label').style.display="none";
});
Hope this helps!


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • 15 replies
  • October 7, 2022

I tried but it didn't work. Maybe I'm not clearly following you. Would it be possible for you to explain the above JS using the following question from my survey? I want to hide the last scale column "Not Applicable" for all the statements in the matrix.
image.png


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • October 7, 2022

sajjid
Within my code you need to change the QID and replace with your scale points QID . Also, include it in the question you are displaying the carry forward choices.
Hope you did the above steps.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5926 replies
  • October 7, 2022

Since it is the last scale point you want to hide, it is quite simple:
Qualtrics.SurveyEngine.addOnload(function() {
jQuery(this.questionContainer).find("td.last,th.last").hide();
});
A bit of constructive feedback - JS shouldn't contain hardcoded QIDs. It isn't necessary, and makes it less flexible and harder to maintain.


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • 15 replies
  • October 11, 2022

Thanks, TomG & Deepak.
What should be the JS code if I want to keep the last column for some statements and hide for the others in the matrix table.
For e.g., in the below screenshot, I want to hide the last column for 'Age' and 'Ethnicity/Culture' but keep the last column for Disability/Exceptionality'. Is there a code to do that as well?
image.png



Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • October 11, 2022

sajjid
By hide i believe you need it to there but be disabled for those rows. Because it would be difficult to hide it .
You can disable it by finding the QID of the radio button by inspect feature and replacing it in below code
document.getElementById('QR~QID6~1~3').disabled=true;
Hope this helps!


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5926 replies
  • October 11, 2022

https://community.qualtrics.com/XMcommunity/discussion/comment/50678#Comment_50678Use this:
Qualtrics.SurveyEngine.addOnload(function() {
jQuery(this.questionContainer).find(".ChoiceRow:first td.last,.ChoiceRow:last td.last").find("*").hide();
});


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • 15 replies
  • October 13, 2022

thanks again, TomG . I realize that I have more than 3 statements (8-9 statements actually). In that case, what should be the JS to hide the last measurement scale (Not Applicable) for some of the statements (e.g. hide the last scale for statements 2, 4, and 6)?


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5926 replies
  • October 13, 2022

https://community.qualtrics.com/XMcommunity/discussion/comment/50829#Comment_50829There are a few different ways to go about it. The quick/inflexible way (won't work with randomization) would be to do it by fixed row position:
Qualtrics.SurveyEngine.addOnload(function() {
var lastTds = jQuery("#"+this.questionId+" td.last");
var hideRows = [2,4,6];
jQuery.each(hideRows, function(i,val) { lastTds.eq(val-1).find("*").hide(); });
});


Leave a Reply