logo

Response

« Return to the main article

You are viewing this page out of context. To see it in the context it is intended please click here.

About This Page

Reply posted by Lenni Sauve on Mon 5 Nov 2007 in response to Form Validator R3.0

Date Validation for 2007/2008 Problem

I am using the validator (love it!) but having a problem validating that an End
date is greater than a Start date when the Start date is in 2007 and the End
date is in 2008.


I have entered the Dateformat of 'mm/dd/yyyy' in validation.js and this is the
format on my server.


Here is an example of my custom validation:
{name: "endDate", type: "custom", expression:
"startEndFunction(this.form.endDate.value, this.form.startDate.value)",
message: "The End Date must be greater than the Start Date"},


Here is my function:
// If a date is entered in the End Date field, it must be greater than the
entry in the Start Date field.
function startEndFunction(entered, start){
if (entered != "") {
return entered > start
}
return true
}


Any suggestions would be much appreciated.


Thanks!