Create Matrix Table Question with Uneven Number of Statements | XM Community
Skip to main content
Question

Create Matrix Table Question with Uneven Number of Statements

  • November 17, 2025
  • 3 replies
  • 52 views

Forum|alt.badge.img+1

Hello,

I wanted to ask if anyone has successfully created a matrix table question with an uneven number of statements for the respective columns. I have attached a screenshot example of what it would like (See Attached). There would be seven statements total (in my example, business activities), but only three of the statements would appear for one column and all seven for the other.

I know I can utilize the ‘Make Answer Exclusive’ for the first column and create a custom validation to limit the number of options checked for the second column. However, after confirming with the Qualtrics Support AI Assistant that this is not possible, I wanted to see if someone has figured out a workaround for this type of situation.

Thanks in advance for any insights!

Regards,

Eric

3 replies

Forum|alt.badge.img+22

You will likely require JavaScript to hide some of the choices of the first scale point.

I am not very knowledgeable in JavaScript to provide a solution to this. Prompt to ChatGPT kept giving me a code that hides the last scale point for last few statements instead of the first scale point.

 

As for custom validation, you probably can use the condition of Scale1(count) is equal to 1 AND Scale2 (count) is lesser than or equal to 2.


Forum|alt.badge.img+1
  • Author
  • November 18, 2025

@Chee Heng_SZ- Thanks for your reply; I figure that was the case (i.e., utilizing JavaScript), but before venturing down this path, I wanted to see if anyone else had successfully created something similar.

I am all good on the custom validation piece; I have completed something similar previously for a different survey, but I do appreciate the insight. 


Tom_1842
Level 8 ●●●●●●●●
Forum|alt.badge.img+28
  • Level 8 ●●●●●●●●
  • December 2, 2025

I think using display: none was hiding the first scale point's checkbox, but its removal was causing the second scale point's checkbox to slide over into the first scale point's position. Using visibility: hidden works to keep the structure the same. Try this:

Create a matrix question with 7 statements and 2 scale points. Allow multiple answers to make checkboxes. Add the below JS which:

  • Enforces selection limit of 1 checkbox for the first scale point (unchecks previous box when another box is checked)
  • Enforces selection limit of 2 checkboxes for the second scale point (no more boxes can be checked when 2 are checked - must unselect to check new boxes)
  • Adds visibility: hidden on the checkboxes in the first scale point for specific rows
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/

var qid = this.questionId;

// Get all checkboxes for Primary and Secondary columns
var primaryCheckboxes = document.querySelectorAll('input[id^="QR~' + qid + '"][id$="~1"]');
var secondaryCheckboxes = document.querySelectorAll('input[id^="QR~' + qid + '"][id$="~2"]');

// Function to update disabled state for Secondary column
function updateSecondaryState() {
var checkedSecondary = Array.from(secondaryCheckboxes).filter(function(c) { return c.checked; });
if (checkedSecondary.length >= 2) {
secondaryCheckboxes.forEach(function(cb) {
if (!cb.checked) {
cb.disabled = true; // Disable unchecked boxes
}
});
} else {
secondaryCheckboxes.forEach(function(cb) {
cb.disabled = false; // Re-enable if under limit
});
}
}

// Limit Primary to 1 selection
primaryCheckboxes.forEach(function(cb) {
cb.addEventListener('change', function() {
if (cb.checked) {
primaryCheckboxes.forEach(function(other) {
if (other !== cb) {
other.checked = false;
}
});
}
});
});

// Limit Secondary to 2 selections and disable extras
secondaryCheckboxes.forEach(function(cb) {
cb.addEventListener('change', function() {
updateSecondaryState();
});
});

// Hide Primary column checkboxes for specific statements
var rowsToHide = [4,5,6,7];
rowsToHide.forEach(function(rowNum) {
var checkbox = document.querySelector('input[id="QR~' + qid + '~' + rowNum + '~1"]');
if (checkbox) {
var tdCell = checkbox.closest('td'); // This should be the <td class="c4">
if (tdCell) {
tdCell.style.visibility = 'hidden';
}
}
});

});