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

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?

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!


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?


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!


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


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.


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.


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



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!


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();
});


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)?


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