Matrix table | XM Community
Skip to main content
Question

Matrix table

  • May 25, 2020
  • 3 replies
  • 38 views

I am working with a matrix table within one of my questions. For the first question within that table, I would like for the option that they choose to grey out that entire column so that it cannot be selected for the rest of the matrix table. The attached file shows this question. For instance, the first question would ask which agency they work for, and if they choose "jail" I do not want them to be able to choose any of the "jail" options for the rest of the sub questions.
Example Question for Qualtrics.docxDoes anyone know if this is possible and/or how to do this?
Thank you!

3 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6082 replies
  • May 25, 2020

You can use JavaScript to disable the remaining checkboxes in the column when the first checkbox is checked.
To avoid writing JavaScript, you could ask the first question (row) as a separate question then either carryforward the unselected choices as scale points or use display logic on the columns.


SurajK
QPN Level 3 ●●●
Forum|alt.badge.img+4
  • QPN Level 3 ●●●
  • 181 replies
  • May 25, 2020

You can use the below code to work this in addOnReady function,

jQuery('tbody tr:eq(0)').change(function(){
for(var i=0;i<4;i++)
{

if(jQuery(this).find('td').eq(i).find('input[type="checkbox"]').is(':checked'))
{
console.log("i = "+i)
jQuery('tbody tr:gt(0)').each(function(){
jQuery(this).find('td').eq(i).find('input[type="checkbox"]').prop('disabled','disabled')
jQuery(this).find('td').eq(i).find('input[type="checkbox"]').prop('checked',false)
jQuery(this).find('td').eq(i).css('background-color','#D3D3D3')
});

}

else
{
jQuery('tbody tr:gt(0)').each(function(){
jQuery(this).find('td').eq(i).find('input[type="checkbox"]').prop('disabled',false)
jQuery(this).find('td').eq(i).css('background-color','white')
});
}


}

});


Forum|alt.badge.img+1
  • 3 replies
  • July 9, 2020

Thanks!