Limiting the number of answers in an array (numbers)

2 months 2 weeks 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!

Please Log in to join the conversation.

LimeSurvey Partners
2 months 2 weeks 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.


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

2 months 2 weeks 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!

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now