Quantcast
Viewing all articles
Browse latest Browse all 17529

Have survey submittable after a certain date? - by: Deusdeorum

Darren wrote:

Deusdeorum wrote: DenisChenu´s answer is probably a better approach but here's a javascript solution that disables button on click with an alert.

<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
 
      var date_now = new Date();
      var sub_date = new Date("2017-1-10");
 
      if (date_now < sub_date) {
          $('#movesubmitbtn').click(function() {
              $(this).prop('disabled', true);
              alert("You cannot submit this survey until" + sub_date);
          });
      }
  });
</script>

That's awesome, thanks! I combined it with {EXPIRY} and a little date math so now it won't be submittable until X days before expiration.

Please carefully test this before using it in production because I haven't.

Viewing all articles
Browse latest Browse all 17529

Trending Articles