Welcome to the LimeSurvey Community Forum

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

Timed question, minimum before progressing

  • dcameron
  • dcameron's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 3 months ago - 9 years 3 months ago #115349 by dcameron
Hi, Im hoping someone can help me.

I have a youtube video embedded in a survey that lasts 10 minutes. I would like to force respondents to sit through the entire ten minutes before they can progress to the next screen (where I have questions, etc.). Right now, it is possible to click "next" and move on without watching the whole video, and I would like to prevent that.

It would be fine to either a) automatically progress after the video is complete, or b) have respondents press the "next" button, after the 10 minutes has elapsed. Either is fine, I just want to make sure they play the whole video.

Is there an easy way to do this? I found this ( limesurvey.com/en/forum/development/9282...individual-questions ) but wasn't sure if it was the answer.

I only want to place this minimum time limit on one question, not the whole survey.

Any help would be greatly appreciated. Thanks!
Last edit: 9 years 3 months ago by dcameron.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #115382 by tpartner
Replied by tpartner on topic Timed question, minimum before progressing
Try adding something like this script to the source of a question on that page. It should hide the "Next" button for 10 minutes.

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {
 
    $('#movenextbtn').hide();
 
    setTimeout(function() {
      $('#movenextbtn').show();
    }, 600000);
 
    });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: holch, dcameron
The topic has been locked.
  • dcameron
  • dcameron's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 3 months ago - 9 years 3 months ago #115467 by dcameron
Replied by dcameron on topic Timed question, minimum before progressing
Fantastic! It worked. Thanks very much, Tony. :)

Im assuming I can modify the timing by changing the 600000. Is 1 = 1/1000 of a second?

Thanks again!!
Last edit: 9 years 3 months ago by dcameron.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #115468 by tpartner
Replied by tpartner on topic Timed question, minimum before progressing
Yes, correct, JavaScript timeouts work in thousandths of seconds.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: dcameron
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #115470 by holch
Replied by holch on topic Timed question, minimum before progressing
Great Tony, another javascript snippet that made it into my collection for useful samples...

@dcameron: yes, for 10 seconds you would write 10000 (the unit seems to be milliseconds)

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
8 years 11 months ago #118702 by Sev
This solution works quite well, as well as the one in the work around for a minimum time:
manual.limesurvey.org/Workarounds:_Manip...ng_forward_in_survey

However, if the questions on the page are mandatory, and the respondent forgets to answer one and click Next, then it seems like the clock is reset, and the respondent has to wait another "minimum time".

Is there a way to avoid this?
Thank you!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 11 months ago - 8 years 11 months ago #118707 by tpartner
Replied by tpartner on topic Timed question, minimum before progressing
Try this. It should only hide the "Next" button if there are no mandatory question errors.

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {
 
    if($('span.errormandatory').length == 0) {
      $('#movenextbtn').hide();
 
      setTimeout(function() {
        $('#movenextbtn').show();
      }, 600000);
    } 
    });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 11 months ago by tpartner.
The following user(s) said Thank You: Sev
The topic has been locked.
More
8 years 11 months ago #118727 by Sev
Perfect, thanks!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose