Index of help pages

Zero quota trick in LimeSurvey

Sometimes you must force the user to give correct answers before proceeding in a survey. The zero quota trick is just for that.

Idea behind quotas

Let's suppose you want responses from at most 10 people over 65 years and 15 from younger ones. Quotas are just for that: You make a single choise selection question and set a quota for some or all of the choises.

You can also set quota to zero. For example you may not want anyone younger than 18 to response your survey.

There are two options if a quota is full: Survey will either end, or the user can go back and try again. Second option is usefull if you want students to select a group and each group has limited number of seats.

The trick

Make a question of type Single choise questions > List (radio). Use "plus" as code, "What is 1+2" as question and "four" and "five" as answer options. Make the question mandatory.

Similarly make a question with code "times", question "What is 2 times 3?" and "five" and "six" as answer options.

Make another question group, and add some question to it.

Now go to Quotas on the left side menu. Click Add new quota on right top corner.

Quota name does not matter, we can use for example "pluswrong" here. To the limit-field put zero, and set quota action to "Alloow user to modify their last answers...". Also write some kind of message. Click Save.

Now click Add answer. Select question "plus" and click Next. Select Four and click Next.

And now another quota with similar pattern, "timeswrong" and zero quota for those who answer that 2×3=5.

Activate the survey. Test. Basically, that's it.

Limitations

First of all, this is somewhat hard to test. You must always activate the survey for testing, and then deactivate to add more questions.

Quotas can only be used for some question types. You can not for example ask what is 2+3 with a text input and allow to continue only if the user writes "5".

And last, you can't make quota for some amount of right answers, like asking ten questions and letting those continue who knows at least eight of them.

Last two limitations can be bypassed with some JavaScript magic and LimeSurvey Expression Manager, but this is error-prone and the survey might become very hard to maintain.

Download example survey.