Cut & Paste Validate Date field script
|
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:
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