Matrix Table - "At Least" Validation | XM Community
Skip to main content
Solved

Matrix Table - "At Least" Validation

  • November 18, 2019
  • 4 replies
  • 26 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

Best answer by ahmedA

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.

4 replies

  • January 28, 2021

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


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Answer
  • January 31, 2021

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.


  • February 2, 2021

Thanks Ahmed!


Forum|alt.badge.img+1
  • January 20, 2022

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