Enable to submit butto after minimum time limit

More
10 months 1 week 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!

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
10 months 1 week ago #168475 by tpartner
Place something like this in the source of a question:

<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

Please Log in or Create an account to join the conversation.

More
10 months 3 days ago #168935 by DVP17lemon
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."

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #169212 by DVP17lemon
Okay, I have found a JS solution for the countdown, here for anybody who will need this:
<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>

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!