Welcome to the LimeSurvey Community Forum

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

How do I disable the nexk button?

  • afmedic905
  • afmedic905's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 1 month ago - 6 years 1 month ago #164100 by afmedic905
How do I disable the nexk button? was created by afmedic905
Hello,

I am creating a survey and need participants to stop at a point in the survey to do some training. I want to disable the next button. Previously I've been able to do this using Java script on version 2.67.3+170728. The version I am using now (3.0.1 + 171228) does not seem to work with the Java script (see below for the script). So then I found this in the manual and tried it. I'm not sure where to find "the general Time limit setting" though.

"Time limit disable next (time_limit_disable_next)

Description

Allows disabling the "next" button while a time_limit countdown is occurring. Normally, even if a time limit countdown is occurring, if the participant wants to click next and move on to the next question they can (thus cutting short the time spent on the question). By selecting "Yes" for this attribute, the next button will appear greyed out and will not be available until the countdown timer has finished.

This settings is only applicable if the general Time limit setting is activated.

Available options

Yes = The Next button will be disabled until the time limit countdown is complete.
No (default)"

Java script

<script type="text/javascript" charset="utf-8">

$(document).ready(function() {

minTime(120);

function minTime(minTime) {

var startTime = new Date();

$('#movenextbtn, #movesubmitbtn').click(function(){

var endTime = new Date();

if((endTime - startTime)/1000 <= minTime) {
alert ('You must spend at least '+minTime+' seconds on the question.');
return false;
}
else {
return true;
}
});
}
});
</script>
Last edit: 6 years 1 month ago by afmedic905.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 1 month ago #164105 by tpartner
Replied by tpartner on topic How do I disable the nexk button?
This should work in 3.x:

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    minTime(120);
 
    function minTime(minTime) {
 
      var startTime = new Date();
 
      $('#ls-button-submit').click(function(){
 
        var endTime = new Date();
 
        if((endTime - startTime)/1000 <= minTime) {
          alert ('You must spend at least '+minTime+' seconds on the question.');
          return false;
        }
        else {
          return true;
        }
      });
    }
  });
</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: afmedic905
The topic has been locked.
  • afmedic905
  • afmedic905's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 1 month ago #164217 by afmedic905
Replied by afmedic905 on topic How do I disable the nexk button?
It worked! Thank you so much! I really do appreciate it.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose