Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Limiting the number of answers in an array (numbers)

  • forlight
  • forlight's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 11 months ago #197574 by forlight
Hey there,

I have a number array in checkbox layout with several rows and also several columns. I would like to limit the number of answers (= checked boxes) per row to two. I already found the solution to use a validation equation, but it produces a really confusing error message ("recheck your answer format" ???) no matter how many boxes per row are checked.

Is it possible to implement that LimeSurvey just unchecks a box if the participant tries to give more than two answers per row? Without any error messages?

Thanks a lot!
Kati
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #197589 by Joffm
Your solution with the validation is fine.
I used:
(count(self.sq_Y001) < 3) and (count(self.sq_Y002) < 3) and (count(self.sq_Y003) < 3) ...
with "Y001"... the codes ot the subquestions.

But in my opinion without seeing your survey, you didn't enter a validation text, that is displayed to the respondents.





Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • forlight
  • forlight's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 11 months ago #197735 by forlight
Thanks a lot for your answer! It works for individual subquestions but the subquestions are being shown only if chosen in the preceeding question. So I tried implementing somethin like this:

if(question_SQ002_SQ002.NAOK, count(self.sq_SQ002) == 2, count(self.sq_SQ002) == 0) and
if(question_SQ003_SQ001.NAOK, count(self.sq_SQ003) == 2, count(self.sq_SQ003) == 0)


"Question" being the preceeding filtering question and "self" being the array question, but now the questionnaire says "you shall not pass", unless both question_SQ002_SQ002 and question_SQ003_SQ001 are shown and have two answers each. Is there some kind of condition expression thich means "if the subquestion is shown"?


Thanks a lot in advance and also for having already helped me several times!
Kati
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose