Well, you have a bigger problem than that.  Let's take your example,
where--after someone selects a start time of 11:45 AM and a finish time
of 12:45 PM--you change your start time list to:

....
11:30AM
01:00PM
....

What if the person selects 11:30 AM (completely valid), and then selects
an end time of 12:00 PM, because they want a (completely valid) 30
minute time slot?  If you have a variable length of appointment, then
you are always going to have this problem; in more general terms, it is
impossible to know for sure whether a start time is valid without also
knowing the duration of the appointment desired.  Likewise, it is
impossible to know for sure whether an appointment length is valid
without also knowing the desired start time.

You could start by asking for the day and then the duration of
appointment the user wants.  Then you could figure out all of the
possible start times during that day for an appointment of that
duration.  The logic of this last step depends a lot on how you store
the data, I guess.  But you can rely on this generalized idea: A start
time ST on a day is valid for a given duration D if ST + D <= the next
already used start time greater than ST.

HTH,
Matthieu

-----Original Message-----
From: Andy Mcshane [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 12, 2006 8:46 AM
To: CF-Talk
Subject: Calculate schedule timeslots


I am sure that I saw something a while back that may address the issue I
have. I have a scheduler that has time slots in increments of 15
minutes. What I need to do is to be able to exclude time slots that have
already been allocated. For example I have start and end time dropdown
lists so a user can select a time slot as follows;

Start time : 11:45 AM     Finish Time : 12:45PM

Once this time slot has been allocated I need to be able to exclude this
range from both of dropdown list i.e.

Start time will now look as follows

11:30AM
01:00PM

End time will be same. I already have the logic to ensure that the start
and end time are not the same and also that the end time is after the
start time but I am struggling to figure out how edit my dropdowns on
the fly as time slots are allocated. Anybody help?

Maybe a more simple method would be to only initially populate the start
time dropdown and use the onchange method to populate the end time box?
Would this be easier do you think?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229513
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to