You are viewing limited content. For full access, please sign in.

Question

Question

Cut-off date for a form to be submitted.

asked on March 25, 2014 Show version history

In Forms 9.1 is there a way to have the form not be submittable after a specific date?

1 0

Answers

APPROVED ANSWER
replied on March 26, 2014 Show version history

There are a few ways you can handle this:

  • Manually hide the business process on the date.
  • Use JavaScript to disable the submit button if the date after the specified date.

 

The JavaScript way is pretty simple. I'll use a library called moment.js. Download that (get moment.min.js) and put it in this folder on your Forms Server: C:\Program Files\Laserfiche\Laserfiche Forms\Forms\js.

 

On the CSS and JavaScript page for your form, paste the following code in the JavaScript section, replacing FormsServer with the name of your Forms Server machine.

 

$(document).ready(function () {
  
  $.getScript('http://FormsServer/Forms/js/moment.min.js', function () {    
    if (moment().isAfter(moment('02-20-1973', 'MM-DD-YYYY')))
    {
      $('.Submit').attr('disabled','disabled');
    }
  });
    
});

You could also have a message appear to let the user know that the form can't be submitted anymore.

2 0
replied on March 31, 2014

Eric,

 

I'm able to get this to work with the date you have entered but I cannot get this to work for me with another date.  I've attached the code I am using.  Please let me know where I'm going wrong.  Thanks

$(document).ready(function () {
  
  $.getScript('http://L7711/Forms/js/moment.min.js', function () {    
    if (moment().isAfter(moment("Feb 20, 2020"))); 
    {
      	$('.Submit').attr('disabled','disabled');
    }
    else {
    	$('.Submit').removeAttr('disabled');
    }
  });
    
});





    

 

0 0
SELECTED ANSWER
replied on March 31, 2014

Hi Nathan,

It looks like that code wasn't quite working! I changed it slightly to use a different format and it looks like it's working now. (I'll update it now) Try this:

 

$(document).ready(function () {
  
  $.getScript('http://L7711/Forms/js/moment.min.js', function () {

    if (moment().isAfter(moment('02-20-2020', 'MM-DD-YYYY')))
    {
      $('.Submit').attr('disabled','disabled');
    }
    else {
      $('.Submit').removeAttr('disabled');
    }
  });
    
});

 

1 0
SELECTED ANSWER
replied on March 31, 2014

Hi Nathan,

It looks like that code wasn't quite working! I changed it slightly to use a different format and it looks like it's working now. (I'll update it now) Try this:

 

$(document).ready(function () {
  
  $.getScript('http://L7711/Forms/js/moment.min.js', function () {

    if (moment().isAfter(moment('02-20-2020', 'MM-DD-YYYY')))
    {
      $('.Submit').attr('disabled','disabled');
    }
    else {
      $('.Submit').removeAttr('disabled');
    }
  });
    
});

 

1 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.