Categories:

Home / Free JavaScripts / Forms / Here

Cut & Paste Validate Date field script

Credit: JavaScript Kit

Description: This script validates a date field to ensure it's in the format mm/dd/yyyy. It also intelligently checks that the date ranges are valid, so something like 02/30/2005 is caught.

Example:

Enter a valid date (mm/dd/yyyy):

Directions:

Step 1: Cut and paste the below script into the <head> section of your page:

Step 2: With the script installed, simply modify your form with the parts in red:

<form onSubmit="return checkdate(this.mydate)">
<input type="text" name="mydate" />
<input type="submit" value="submit" /><br />
<b>Valid date format:</b> mm/dd/yyyy<br />
<input type="submit" value="submit" />
</form>

"mydate" is an arbitrary name of the date field within your form.


JavaScript Tools:
Site Info


CopyRight (c) 2018 JavaScript Kit. NO PART may be reproduced without author's permission. Contact Info