Disabling or changing the color of certain tick boxes | XM Community
Solved

Disabling or changing the color of certain tick boxes

  • 26 April 2024
  • 2 replies
  • 25 views

Badge +1

Hi, I’m collecting some network data. I have created a question that uses piped text from an earlier question to make a (max) 5 x 5 grid of the previous responses.

 

I want to disable the possibility of ticking the box between two same responses (piped from the previous question). If disabling is too tricky, alternatively, I can just change the color of these boxes to grey. (See the attached picture; the boxes I want to alter are in red rectangle.)

 

I have looked into changing the color of a tick box but thius far have only runned into the error ‘Invalid JavaScript! You cannot save until you fix all errors: Unexpected token.’

 

Anyone can help me out?

 

 

icon

Best answer by ahmedA 26 April 2024, 13:23

View original

2 replies

Userlevel 7
Badge +21
Qualtrics.SurveyEngine.addOnReady(function () {
const quest = this;
const qc = quest.getQuestionContainer();
const allRows = qc.querySelectorAll(".ChoiceRow");
let col = 1;

for (let row = 0; row < allRows.length; row++) {
const allCols = allRows[row].cells;
const refCell = allCols[col];

refCell.querySelector("input").disabled = true;
refCell.style.cursor = "not-allowed";
refCell.style.opacity = 0;
Array.from(refCell.children).forEach((item) => {
item.style.cursor = "not-allowed";
});
col++;
}
});

 

Badge +1

Cheers admedA, works like a charm 👌👌👌👌👌

Leave a Reply