I see 10,000 ways to validate date fields on forms. But all of them are based on a single text box using mm/dd/yyyy type formats. My forms have the date seperated into individual fields. a 2 digit month in one input box, 2 digit day input box and 4 digit year input box.

month.text
day.text
year.text

I'm using asp.net forms so using range validator I validate that the month field is between 1-12 day is between 1-31 and year is between 1800-2250, but that really doesnt do much good. Users can still enter invalid dates such as: 02/30/2010.

I also have a seperated date field that must be either "today" or a future date.

There are scripts everywhere for these if we used the old standard single text box, but since mine are seperate fields how do I do this?

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

TronixGT

05-24-2009, 07:26 PM

Thanks Philip, That at least got me started in the right direction.

The first script basically accomplished the same thing that RangeValidation in asp.net does. it made sure month is 1-12 day is 1-31.. etc. But it did not account for days like february 29th or february 30th. I have found some code that does work, and does check for a true valid date. That seems to be working now.

I am trying to use the FutureDate function you posted, but it is allowing any date in the month of may and it should only allow today and future dates.. so it doesnt quite check the month/day right. Is this a MM/DD/YYYY type format issue? I can't figure this out.