Matrix table | XM Community
Question

Matrix table


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

Userlevel 7
Badge +27

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.

Userlevel 5
Badge +4

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


}

});

Badge +1

Thanks!

Leave a Reply