Paul
|
| Posted: 04/16/2002, 3:42 AM |
|
I have a series of date verifications that need to take place on 'insert'/'submit':
I have three date fields on my form (fldWeek_Commencing, fldStart_Date, fldEnd_Date)
And these are the rules that need to be verified:
Firstly.... must be in the following date format dd/mm/yyyy then:
fldWeek_Commencing: must be a monday
fldStart_Date: must be within six days of the fldWeek_Commencing (i.e. within the aforementioned week (Mon-Sun)
fldEnd_Date must be <> than fldStart_Date
I want this validation to take place on submit, or as they are filling it in if possible?
Thanks in advance, Paul
|
|
|
 |
Nicole
|
| Posted: 04/16/2002, 5:23 AM |
|
Paul,
first use JavaScript to validate date format. Try to search for ready one that allows enter date in given format only.
Other validations could be made on server side or client side (as you like). I think you'd better use JavaScript calendar to let users select date.
|
|
|
 |
Paul
|
| Posted: 04/16/2002, 6:41 AM |
|
Thanks for that Nicole,
I have used a modified javascript calender to select dates, but i still need to verify that the Start_Date is within 7 days of Week_Commencing Date, that End_Date is equal to or greater than the start_date
can you help? this could be done on 'insert'
thanks in advance
|
|
|
 |
Nicole
|
| Posted: 04/16/2002, 11:43 PM |
|
Paul,
as I understand you want to verify Week_Commencing Date and End_Date after user submits the form then use script language date functions. You can calbulate Week_Commencing Date automatically in Before Insert and/or Before Update event. Set it as Hidden field and just add 7 days to start_date. In Validation event put code to calculate difference e.g. in days between start_date and end_date. Again use language date functions. In case difference is e.g. <= 1 day, then add error message to sFormNameErr variable.
|
|
|
 |
Paul
|
| Posted: 04/17/2002, 2:48 AM |
|
Nicole
I have sorted the end_date being before the start_date.
How would i add the custom validation for the start_date not being more than 6 days after the Week_Commencing Date....
I don't mind just editing the code as this is a one off form....
Thanks in advance
Paul
|
|
|
 |
Nicole
|
| Posted: 04/17/2002, 3:22 AM |
|
Paul,
use the same approach as described in my previous response. Calculate the difference between start_date and Week_Commencing Date.
|
|
|
 |