Welcome to the LimeSurvey Community Forum

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

Have survey submittable after a certain date?

More
8 years 7 months ago - 8 years 7 months ago #146945 by tpartner
Try this:

Code:
<script type="text/javascript" charset="utf-8">    
 
  $(document).ready(function() {
 
    var date_now = new Date();
    var sub_date = new Date("2017-1-15");
 
    if (date_now < sub_date) {
      $('#movesubmitbtn').click(function(e) {
        e.preventDefault();
        alert("You cannot submit this survey until" + sub_date);
        return false;
      });
    }
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 7 months ago by tpartner.
The topic has been locked.
More
8 years 7 months ago - 8 years 7 months ago #146947 by Deusdeorum

tpartner wrote: Try this:

Code:
<script type="text/javascript" charset="utf-8">    
 
  $(document).ready(function() {
 
    var date_now = new Date();
    var sub_date = new Date("2017-1-15");
 
    if (date_now < sub_date) {
      $('#movesubmitbtn').click(function(e) {
        e.preventDefault();
        alert("You cannot submit this survey until" + sub_date);
        return false;
      });
    }
  });
</script>


Hehe, I fucked up in Date("x-x-x") in first script, apparently "2017-1-15" is not a valid date (doh). Anyhow, this is working fine on iphone 6+7:

Code:
This is an array with condition on first sub-question in survey2. <script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
 
      var date_now = new Date();
      var sub_date = new Date("2017-01-11");
 
      if (date_now < sub_date) {
          $('#movesubmitbtn').on('click touch', function() {
              $(this).prop('disabled', true);
              alert("You cannot submit this survey until" + sub_date);
          });
      }
  });
</script>
Last edit: 8 years 7 months ago by Deusdeorum.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose