Nido
|
Posted: 01/04/2002, 9:36 AM |
|
I am using ASP 2.0 and Templates.
I have a RECORD form with two date fields (start_date and end_date) and I want to validate that the start_date is Chronologically before the end_date while entering a new record or editing an existing record.
Since I don't want to use JavaScript to do the validation, I want to use CC's validation code, what would be the code for ASP and where would I put the code?
Also I would like to know how to write the failed validation message to the form like the normal CC validation error messages are written.
Thanks and Happy New Year to all!
|
|
|
Alex Alexapolsky
|
Posted: 01/05/2002, 3:06 AM |
|
You should place some code in record forms Form Properties/Events/Validation ,
you should use simple asp code to compare fields start_date and end_date via
date_diff function. If there is an error you should assign error message to
s[FormName]Err variable where Form Name should be replaced with yours.
DateDiff(interval, date1, date2 [,firstdayofweek[, firstweekofyear]])
The DateDiff function syntax has these parts:
Part Description
interval Required. String expression that is the interval you want to use to calculate the differences between date1 and date2. See Settings section for values.
date1, date2 Required. Date expressions. Two dates you want to use in the calculation.
firstdayofweek Optional. Constant that specifies the day of the week. If not specified, Sunday is assumed. See Settings section for values.
firstweekofyear Optional. Constant that specifies the first week of the year. If not specified, the first week is assumed to be the week in which January 1 occurs. See Settings section for values.
|
|
|
|