Welcome to the LimeSurvey Community Forum

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

Maximum number of participants

  • aeMKei
  • aeMKei's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 6 months ago #159501 by aeMKei
Maximum number of participants was created by aeMKei
Hey everyone,
I'm trying to restrict the number of participants for my survey to a certain maximum. When this number is reached I want the survey to stop (expire) OR at least forward new participants to a new page with a message like "The maximum number of participants have already participated". I have read through at least 30 forum posts concerning this topic but none of the solutions is of any help for me so far.
What I found out is using a hidden question and combine it with the quota feature. So now my survey consists of two parts:
1) an introduction (with some introductory text and the hidden question(single choice dropdown-list with preselected answer))
2) questions to be filled out while the quota isn't reached yet.
For some reason this doesn't work. I can see the counter in my quota section with the correct value, based on the amount of responses I got so far. Whenever someone fills out the survey this counter increments (as it should be). The limit is set to a fixed value, I have entered a quota message and also a page where participants should be forwarded but the quota counter just continues incrementing instead of stopping the survey. People can access the survey when the counter has hit the limit or is greater than the limit. Do I somehow misunderstand the quota feature?
Our server runs LimeSurvey Version 2.05+ Build 140320 under PHP 5.6.

Regards
aeMKei
The topic has been locked.
  • aeMKei
  • aeMKei's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 6 months ago #159504 by aeMKei
Replied by aeMKei on topic Maximum number of participants
Ok after some fiddling around I managed to do it. Here's what helped me:
1.) I went to the IRC channel where people talked me through some steps. I can recommend that because people can ask questions you haven't thought of. But be patient.
2.) There obviously is a problem if you enable the field "always hide" in the extended settings of a question. My first lesson was: don't do that. Instead disable it (meaning the question is always displayed) and use a script to manually hide it.
3.) You can hide the question via script with the help text section of a question. I tried editing the template as well before but that didn't work. Figure out the ID of the question, then use simple HTML script tags to include:
Code:
$('#question{QID}').hide();
. My question had the ID 1976 so in the help text section of the question that I wanted to not be displayed I entered:
Code:
<script>$('#question1976').hide();</script>
4.) Save and close the question, then open it again and check the help text section in text and code view. In my case BOTH were empty, meaning the script that I entered was deleted after saving. That was due to my global safety settings, which had "filter HTML for XSS" enabled. That needs to be disabled to make it work.
5.) Now my counter is incrementing correctly and after the maximum is reached, participants get either a message or are forwarded to another page.

Props go out to TonisOrmisson and Deusdeorum .
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 6 months ago - 6 years 6 months ago #159509 by tpartner
Replied by tpartner on topic Maximum number of participants
If using a current LimeSurvey version, you can hide the question by simply adding a question class "hidden".

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 6 months ago by tpartner.
The topic has been locked.
  • aeMKei
  • aeMKei's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 6 months ago #159511 by aeMKei
Replied by aeMKei on topic Maximum number of participants
Has this been described somewhere in a little bit more detail?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 6 months ago #159521 by tpartner
Replied by tpartner on topic Maximum number of participants
The current version uses Bootstrap so all helper classes should be available - getbootstrap.com/docs/3.3/css/#helper-classes-show-hide


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose