Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I need to have a user select a date. The date has to be a specific format so the only way I can figure to do that is have a drop down list for month, day and year. How would I make it so if the user picks Jan then the days has 31 but if they select Feb there will only be 28? Or if there is a better way to have someone enter date I am open to suggestions. Needs to be in ASP, JavaScript or VBScript.
Thanks.

Each element of the date should be separated, so they each return a VALUE. Then get the user to choose Month first, which the Days element uses in an IF statement to offer the appropriate number of days depending on what value was returned by Month.
The only problem you will still have is the 28/29 February change for leap years. For this you can hard code a selection of years in another IF statement, namely, that if Month is February AND Year is 1992, 1996, 2000, 2004 (or whatever) offer 29, ELSE offer 28.
This will work best if you get the user to input YEAR first, then MONTH, so there are two values returned which DAY can look at.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |