Welcome to the LimeSurvey Community Forum

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

Timer (force the participants to stay on one page)

  • timkim119
  • timkim119's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 10 months ago #135764 by timkim119
Hi
I really appreciate the work you do as well as the support and solution you provide.

I'm currently making a survey and was wondering if it's possible to put a timer on a group of questions
I need to have some pages with different texts and want to make sure that the participants read the texts of those pages. (and not just skip the page)

In order to do that, I want to set a timer (2-3 minutes) forcing them to stay on that page (during these 2-3 minutes, participants cannot click on "next page" button for example)

My version is "Version 2.50+ Build 160418"

Thank you for your help

best,
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 10 months ago - 7 years 10 months ago #135790 by tpartner
You can add something like this to the question source:

Code:
<script type="text/javascript" charset="utf-8">    
  $(document).ready(function() {
    // Hide the "Next" button
    $("#movenextbtn").hide();
 
    // Show the button after n milliseconds
    setTimeout(function () {
      $("#movenextbtn").show();
    }, 120000);
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 10 months ago by tpartner.
The following user(s) said Thank You: timkim119
The topic has been locked.
More
7 years 4 months ago #143382 by Cloudkicker
Replied by Cloudkicker on topic Timer (force the participants to stay on one page)
Hello Everybody :)

I have the same question and and i already tried the code from tpartner. Do i have to put it to the Question source of the question or the question group? And do i habe to change the time "n milliseconds" or give any number for n?

Thanks a lot for your help.

Greets :)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 4 months ago #143407 by tpartner
Place the script in the source of any question on the page. See here for tips on inserting JavaScript - manual.limesurvey.org/Workarounds:_Manip...tc..29_in_LimeSurvey

Replace the "120000" with the number of milliseconds you want to delay.

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: Cloudkicker
The topic has been locked.
More
7 years 4 months ago #143518 by Cloudkicker
Replied by Cloudkicker on topic Timer (force the participants to stay on one page)
Thank you for you answer. Unfortunately it still doesn't work and i have no idea why :( I have to admit that i have no experience with JavaScript so please excuse my answers. Could you maybe have a look at what i did? I put the code behind a inframe-code (for a video) in the question box. So i want that the participants have to watch the video before they can go to the next site.

<iframe frameborder="1" height="810" scrolling="yes" src="/limesurvey/upload/surveys/195867/flash/VERS3%20G%20converted.mp4" width="1440"></iframe><script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Hide the "Next" button
$("#movenextbtn").hide();

// Show the button after n milliseconds
setTimeout(function () {
$("#movenextbtn").show();
}, 158000);
});
</script>


Thank you very much!!!!!!
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 4 months ago #143520 by Joffm
Hi, cloudkicker,
I just tested this code (very similar to yours, except of the source of the video)
Code:
Please, watch the video.
Please, watch the video
<p><iframe allowfullscreen="" frameborder="0" height="360" src="http://www.myserver.de/limesurvey/upload/surveys/252416/files/Lonesome.mp4" width="640"></iframe></p>
<script type="text/javascript" charset="utf-8">    
  $(document).ready(function() {
    // Hide the "Next" button
    $("#movenextbtn").hide();
 
    // Show the button after n milliseconds
    setTimeout(function () {
      $("#movenextbtn").show();
    }, 10000);
  });
</script>

And it works as expected.
Just see this small example: (after 10 sec there appears the button)
www.mafoservice.de/survey/index.php/979581?lang=de


What exactly doesn't work in your survey?

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: tpartner, Cloudkicker
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 4 months ago #143524 by tpartner
Cloudkicker, can you activate a test survey and give us a link so we can see the source code?

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: Cloudkicker
The topic has been locked.
More
7 years 4 months ago - 7 years 4 months ago #143527 by Cloudkicker
Replied by Cloudkicker on topic Timer (force the participants to stay on one page)
Thanks a lot! I tried it with the code from Joffm in a new testsurvey ( 141.30.89.220/limesurvey/index.php/726177/lang-de ) and it works. Unfortunately it still doesn't work in my mainsurvey ( 141.30.89.220/limesurvey/index.php/195867/lang-de ) with the exact same code.

nextbutton = "weiter"-button

Is there any posibility that it doesnt work because i already have a code behind the question with the video? --> I have three different videos/groups in my survey and it randomly shows you one of the three videos.

Thats my very last idea to solve the problem :unsure:

Greetings
Last edit: 7 years 4 months ago by Cloudkicker.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 4 months ago #143529 by tpartner
Your template seems to be broken and has JavaScript errors preventing that script from running and the progress bar from working..

Among possible other problems:
- There is a JavaScript error on line 3 of the source - "setJsVar is not defined".
- There is a JavaScript error on line 434 of em_javascript.js.
- There are scripts and links to stylesheets inserted before the opening <html> tag.
- There is no closing </head> tag.
- There is no opening <body> tag

I would start with fixing these and retesting.

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: Cloudkicker
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 4 months ago #143530 by Joffm
Hallo,

Bitte, nimm den Schreibfehler bei "abbonieren" heraus -> "abonnieren"

Bis dann
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Cloudkicker
The topic has been locked.
More
7 years 4 months ago #143544 by Cloudkicker
Replied by Cloudkicker on topic Timer (force the participants to stay on one page)
Thank you guys for all your help and all the time you invested!!!! You are great!

Greetings :)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose