- Posts: 9
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
3 years 11 months ago #197574
by forlight
Limiting the number of answers in an array (numbers) was created 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
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3965
3 years 11 months ago #197589
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Limiting the number of answers in an array (numbers)
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
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
Attachments:
The topic has been locked.
- forlight
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
3 years 11 months ago #197735
by forlight
Replied by forlight on topic Limiting the number of answers in an array (numbers)
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
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.