Jump to content

Prevent Date Selection Less Than 2 Weeks In Future


Recommended Posts

Hello abitaquest,

 

On your Submission Form, you can add a Header & Footer element. Then you can select the Footer element, click the "Source" button and enter the following code:

<SCRIPT LANGUAGE="JavaScript">


function check_date()
{
var entered_value = document.getElementById("InsertRecordDate").value;
var entered_date = new Date(entered_value);


var two_week_date = new Date();
two_week_date.setDate(two_week_date.getDate() + 14);


if(entered_date < two_week_date)
   {
      alert("Please select a date after 2 weeks");
      return false;
   }
}


document.getElementById("caspioform").onsubmit=check_date;
</SCRIPT>

Please enter name of your field instead of "FIELDNAME" in the line

var entered_value = document.getElementById("InsertRecordFIELDNAME").value;
 
Also you can enter your message instead of "Please select a date after 2 weeks".
 
I hope, it helps.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...