Welcome to the LimeSurvey Community Forum

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

Enable to submit butto after minimum time limit

  • DVP17lemon
  • DVP17lemon's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 10 months ago #168466 by DVP17lemon
Dear LimeSurvey Community,

I only want to ask how it is possible to set up a minimum time a user must spend on a question until the submit button is enabled or appears. This would be the opposite of a maximum time limit as already available. So for example: 20 seconds must be passed until the user can click "submit".

Thank you very much for your attention!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #168475 by tpartner
Place something like this in the source of a question:

Code:
<script type="text/javascript" charset="utf-8">
 
  // Delay time in seconds
  var delayTime = 20;
 
  $(document).on('ready pjax:scriptcomplete',function(){
    $('#ls-button-submit').prop('disabled', true);
    setTimeout(function() {
      $('#ls-button-submit').prop('disabled', false);
    }, delayTime*1000);
  });
</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, DVP17lemon
The topic has been locked.
  • DVP17lemon
  • DVP17lemon's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 10 months ago #168935 by DVP17lemon
Replied by DVP17lemon on topic Enable to submit butto after minimum time limit
Thank you very much! Is there also a way to have a countdown in the Help-Text like: "The submit button will be enabled in 5/4/3/2/1 seconds."
The topic has been locked.
  • DVP17lemon
  • DVP17lemon's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 10 months ago #169212 by DVP17lemon
Replied by DVP17lemon on topic Enable to submit butto after minimum time limit
Okay, I have found a JS solution for the countdown, here for anybody who will need this:
Code:
<div>The "next" button <span id="timer1">will be enabled in 10 <span> seconds. </span></span></div>
<script>
   window.onload = function(){
     var sec = 9;
     setInterval(function(){
 
       document.getElementById("timer1").innerHTML = "will be enabled in " +sec +" seconds.";
       sec--;
       if(sec < 0){
    document.getElementById("timer1").innerHTML = 'is now enabled.';
    }
      },1000);
    }
    </script>
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose