| Validate Year [message #155811] |
Wed, 18 January 2006 15:19  |
Duane
Messages: 588 Registered: December 2002
|
Senior Member |
|
|
I'm just seeing if anyone has come up with a way to validate/check a year so that it is somewhat current?
A web form allows you to enter a date, such as, MM/DD/YYYY and the person enters 01/20/0006 instead of 01/20/2006. Besides seeing if the year < 2000, is there any other way?
[Updated on: Wed, 18 January 2006 15:26] Report message to a moderator
|
|
|
|
| Re: Validate Year [message #155848 is a reply to message #155811] |
Wed, 18 January 2006 22:46   |
Art Metzer
Messages: 2480 Registered: December 2002
|
Senior Member |
|
|
| Quote: | Besides seeing if the year < 2000, is there any other way?
| No, you simply need to codify your definition of "somewhat current".
|
|
|
|
| Re: Validate Year [message #155889 is a reply to message #155811] |
Thu, 19 January 2006 09:01   |
Duane
Messages: 588 Registered: December 2002
|
Senior Member |
|
|
|
I was meaning current century. The date, 01/20/0006, is a valid date but not for this current century. I was just looking at what I could do to let the user know that the date entered is not within this century.
|
|
|
|
|
|
| Re: Validate Year [message #155895 is a reply to message #155892] |
Thu, 19 January 2006 09:39   |
JSI2001
Messages: 1016 Registered: March 2005 Location: Scotland
|
Senior Member |
|
|
If it's a form, why not create a 3 comboboxes (pull down menus) with valid days, months and years, then create a date from the choices made.
Jim
|
|
|
|
|
|
|
|
| Re: Validate Year [message #155929 is a reply to message #155896] |
Thu, 19 January 2006 13:26   |
William Robertson
Messages: 1643 Registered: August 2003 Location: London, UK
|
Senior Member |
|
|
Perhaps you could do some basic validation in JavaScript?
Would 1999 be invalid then? Perhaps your rule could be that the date entered should be within, say, 50 years of the current date.
|
|
|
|
|
|
| Re: Validate Year [message #155936 is a reply to message #155929] |
Thu, 19 January 2006 14:38  |
Duane
Messages: 588 Registered: December 2002
|
Senior Member |
|
|
|
A year of 1999 would be invalid. I'll see what I can come up with. These are all good ideas and I do appreciate the help.
|
|
|
|