Friday, April 2, 2010

Limit times in dropdown menu

I have a series of pages for reserving meeting rooms at our business. First page you pick the date. Second=time, third=equipment, etc. All of it writes to a database and emails the reservation to me. In the drop down menu for time, I would like to limit the displayed times to an hour ahead if the date is the same day. For example, if it is 8:00am on July 9th(today), the first available time displayed would be 9:00am. But if the date is July 10th(tomorrow), all times would be displayed. Is there actually a way to do this or am I asking for some heavy duty professional coding?

Any help is greatly apprecaited!

Limit times in dropdown menu

There are two ways you can do this one is using JavaScript, which would be unreliable as it would depend on the user having his system clock set correctly. The other would be to use a server side language and check that the date/time selected is at least one hour more than the time submitted, you could also use a combination of these methods (the better option).

For a description on the php date time function see - http://uk3.php.net/manual/en/function.date.phphttp://uk3.php.net/manual/en/funct ion.date.php

For checking your date/time in JavaScript see - http://www.web-source.net/web_development/javascript_date.htm

An alternative would be to use spry for your javascript validation, see the info for using the validation widget at - http://labs.adobe.com/technologies/spry/home.html

PZ

No comments:

Post a Comment