Gray out and block entry in a couple matrix constant sum boxes | XM Community
Question

Gray out and block entry in a couple matrix constant sum boxes

  • 22 June 2020
  • 6 replies
  • 131 views

Userlevel 1
Badge +2

We're using a matrix constant sum survey question to have respondents record a count each day for 1 month. Each column is a day of the week (Sun-Sat), but the first of the month is on a Wed so we don't want respondents to enter counts in the boxes for Sun-Tue of that first week. Validations prevent me from setting up a default answer of "X" in these 3 boxes. Is some kind of JS I can add that will allow me to gray just those 3 boxes out, and maybe prevent data entry?
image.png


6 replies

Userlevel 7
Badge +27

You can do this:
jQuery("#"+this.questionId+" tr:last input[type=text]").each(function(i) {
if(i<3) this.disabled = true;
});
Since they will show with zeros, you may want to hide them instead. If so, replace this.disabled = true with jQuery(this).hide().

Badge

Hi TomG
I have a similar query where I want to grey out the first row only. I am using the below code but it is not working. Can you please help? Thanks in advance
jQuery("#"+this.questionId+" tr:first input[type=text]").each(function(i) {
if(i<3) this.disabled = true;
});

Userlevel 7
Badge +27

Disable first row:
jQuery("#"+this.questionId+" tr.ChoiceRow:first input[type=text]").prop("disabled",true);

Hi TomG
I have similar issue and need to make choice gary out/not select when quota is reach to limit. Can you please help ?

this will show user that time slot is full and they can not select
Capture.JPG same one

Userlevel 7
Badge +27

https://www.qualtrics.com/community/discussion/comment/31344#Comment_31344You can disable the inputs the same way as above, except they are type "radio" instead of "text". When disabled they won't be selectable. You would need to apply CSS to gray out the labels. You would need to need pipe in either Quota Met or Quota Unmet flags to use in your logic.

Badge +1

Hi TomG ,
Is there a similar code to above that disables the first column of a matrix question?
In the question below. I need to disable the first column, but not hide it as respondents need to see their answers from a previous question.
disable first column.PNG
Thank you in advance!

Leave a Reply