Really that line just depends on what you want to be the max year. For what I wanted, I didn't want to allow the current year.By Tom Flynn, Sun Gard Higher Education, and Jeralee Seaburn, Hercules Tire Problem: Started in a Focal Point post, the question is, how to validate Date (calendar) controls in a guided ad-hoc HTML page?function button1_onclick(ctrl) //End function button1_onclick //This goes in the BODY portion of the HTML Add this phrase to any date control you want to call the function from: on Change="checkdate(this)" //We had to use onchange instead of onblur //because our call center software was interfering //with HTML code and causing the control to lose focus - // we ended up in an infinite loop of error messages.When capturing information for insertion into a database, or use in other processing, it's important to control what the user can enter.
The following example shows how you can do this for the mm/dd/yyyy format.Here is a another version which I removed the year validation that shall be between some years.I think that this check shall be done outside the function as its purpose shall be any date validation only. Though, the part I consider a real amelioration is the auto detection of indexes.But then again, I would hope it is fairly simple to adapt my code.Although I would like to point out that my code does allow for the separators '/', '.' and '-' so that should cover a lot of them.
There have been so many problems with users not entering the date in mm/dd/yyyy, even when specifically stated on the screen.