Auto-Select Matrix Table | XM Community
Skip to main content
Question

Auto-Select Matrix Table

  • April 26, 2023
  • 2 replies
  • 84 views

Forum|alt.badge.img+1

Hi all,

I have a matrix question with two columns: one is “Tracking” and the other “Reported to Leadership”. If a person selects “Reported to Leadership” I want “Tracking” to automatically be ticked off as well. Is this possible within jQuery? I am not familiar with jQuery at all. 

2 replies

Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • April 26, 2023

If you want both columns to be mutually exclusive of each other then just use single select matrix type or if you are using multi select then just make any one column as mutually exclusive.


qualtrics_nerd
Level 5 ●●●●●
Forum|alt.badge.img+19
  • Level 5 ●●●●●
  • April 26, 2023

Hi @EthanW ,

Assuming you have below structure:

 


Add below JS code to achieve the functionality of Auto select:

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

});

Qualtrics.SurveyEngine.addOnReady(function()
{
let que=document.getElementById(this.questionId);

let fcol=que.querySelectorAll("td.c4");

let lcol=que.querySelectorAll("td.c5");


que.addEventListener("click",function() {
for(let i=0;i<lcol.length;i++)
{

if(lcol[i].childNodes[1].checked)
{

fcol[i].childNodes[1].checked=true;

}


}
});

});

Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/

});

Hope this resolves your query😊!!