Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating dates based on select field?

Status
Not open for further replies.

Jawa

Programmer
Feb 21, 2002
74
0
0
US
Hi All,

I have a form that I am trying to fulfill the following scenario. Does anyone have any advise/solutions? I have a registration form.

On the form are the following fields:

-US State Pulldown
-Country Pulldown
-5 Night Hotel Pulldown
-3 Night Hotel Pulldown
-Arrival Date (pop-up calendar)
-Departure Date (pop-up calendar)

I need the form to do the following:
* If I choose a US State from the pull down the Arrival Date on the calendar needs to be 30 days from todays date with no dates previous available. If it easier to do this with a mo/dd/yy series of dropdowns I am OK with switching it out.

* If I choose a Country from the pulldown the Arrival Date on the calendar needs to be 45 days from todays date with no dates previous available.

* If any hotel is selected from the 5 Night Hotel Pulldown then the calendar arrival and departure dates must be tested so the days are minimum of 5 days.

* If any hotel is selected from the 3 Night Hotel Pulldown then the calendar arrival and departure dates must be tested so the days are minimum of 3 days.

Any suggestions I am very VERY much open to!! THANK YOU!!!

Thank You Very Much,
Michael
 
Michael

I don't know what version of CF you are using but if you are using MX7 then have a look at the cfcalendar function. that allows you to easily "shut off" dates from being selected. Take a look at this article on Ben Forta's site:


regarding the validation, you can either do it using javascript or by using cf dateCompare function.

if you go with the javascript route take a look here:

you should find all of the functions that you need

Hope this helps!

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top