Matrix Table - "At Least" Validation | XM Community
Solved

Matrix Table - "At Least" Validation

  • 18 November 2019
  • 4 replies
  • 18 views

Hello,

I'm currently trying to have students select all their availability from a matrix table for a particular service:

!


We are looking to have students select a minimum of 3 check boxes.

However, when the "at least" validation is selected, it is looking for at least 3 columns to be completed - not specific, individual check boxes.

Any assistance?

Much appreciated.

Tim
icon

Best answer by ahmedA 31 January 2021, 22:07

View original

4 replies

Hi Tim,
I'm having a similar issue, did you find a resolution?
Thanks.
Helen

Userlevel 7
Badge +21

You can use the following JS to implement it:
Qualtrics.SurveyEngine.addOnReady(function(){
that = this;
var init_ques = this.getQuestionTextContainer().innerText;
this.disableNextButton();
this.questionclick = function () {
var a = that.getSelectedAnswers();
var ch = Object.values(a).reduce(function (a, b) {
return a + b;
},0);
if(ch >=3){
that.enableNextButton();
that.getQuestionTextContainer().innerText = "Okay to proceed";
} else {
that.disableNextButton();
that.getQuestionTextContainer().innerText = init_ques;
}

});

Demo here.

Thanks Ahmed!

Badge +1

Hi Ahmed,
Can you help me!
I have a matrix multi select question and scale options are getting piped in from pervious question. So scales are dynamic in this case. I wish to have a validation such that. I need to force at least- selection per scale/column. And if statements remain unanswered that's alright.
I want to have validation based on column and not based on statements i.e., rows
Waiting for your response

Leave a Reply