I am trying to validate user input in a date field. I want to display a message if they enter a date previous to today. I have looked on numerous sites and can't find anything. Any help will be much appreciated.
Well snce the Date object gives you integers when getMonth() etc is called - you face the problem of getting good data input. You need some way of getting the right format inputted or modifying it. Once this is done, you just need an if statement which first comapares the year - then the month then the day - each time asking if it is before the current ones.
Select boxes probably provide the easiest way to ensure data entry, without having to validate all the time - maybe except for the year.
b2 - benbiddington@surf4nix.com
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.