How can I validate checkboxes in a table against the following conditions?

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

If you convert to military time it would be a bit easier to manipulate the validation logic.
Would also compress your code a bit. Could be compressed further if you put the appointment times into an array.

If you convert to military time it would be a bit easier to manipulate the validation logic.
Would also compress your code a bit. Could be compressed further if you put the appointment times into an array.

Since you did not supply any CSS or starting JS, this is only a starting idea for the validation process.

More questions:
1. Minimum time slot is 1 hour, but is there a maximum time, ie: greater than 1 hour, like 8:30-10:00 or 10:30?

2. Why not just make 1 hour slots on the 1/2 hour? Then there would be no need to check on the half hour.

Thank you very much for your reply. My answers to your questions:
1. It can be any hour or hours but it can't be half an hour(e.g it can be 2 hours from 08:00 AM - 08:30 AM & 08:30 AM - 09:00 AM to make an hour and 12:00 PM - 12:30 PM & 12:30 PM - 01:00 PM to make another hour. So in this case the user is available for 2 hours. In this case a user can't be available for 2 and half hours as I mentioned before.)

2. Because a user can be available from 9:30 to 10:30.(In this case 09:30 AM - 10:00 AM & 10:00 AM - 10:30 AM should be selected.)

If the user can only select block of one hour (contiguous block ???), there must be a solution by treating the block pairs...
An other idea is to store the choice in an unique integer N which is the sum of 1<<n for the choice of the cell number n (from 0 to 20).

If the user can only select block of one hour (contiguous block ???), there must be a solution by treating the block pairs...
An other idea is to store the choice in an unique integer N which is the sum of 1<<n for the choice of the cell number n (from 0 to 20).

Sorry but the conditions are not clear enough to build something ...
Is'it possible to choose 8:00 to 9:30 and 10:00 to 11:00 ? Many users have to cover the all periods ?
A well-posed problem always has a solution !
I wanted only show an method without check-boxes...

The importance is to ensure that you are using the right string format or evaluating the string in to a format that you can use properly like getting the values the right way around.

STOP using $ prefix on JavaScript variable names...
Please remember to wrap any code you have in forum tags:- [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]If you can't think outside the box, you will be trapped forever with no escape...