Date Validation - dd/mm/yyyy
Cut and Paste Code
Cut 'n' paste code for the above Example
- Function isDate is used
to verify if the given value is a valid date in the format (mm/dd/yyyy)
: This function first specifies the non-digit character which
is allowed in the date ("/"
is used here). You can also specify the year range between which
the date is valid. These changeable values are declared in the
lines (found in the beginning of the code) :
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
Now the date string is seperated into the day, month and year integers. They are each validated seperately and combined together.
- Function ValidateForm is used to check if the date field is valid on form submission