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.

Enjoy an ad free experience by logging in. Not a member yet? Register.

“Old Pedant” I implemented you code in my application and it is working fine but I also want to give them an option to check/uncheck all checkboxes which are not checked and are not disabled(Should meet both conditions to check/uncheck checkboxes) and to maintain my old conditions you already met.

When a user opens an already created slot I am making all the appropriate checkboxes checked and only making the checkboxes disabled where the time has been booked.

For example if a user checked “08:00 AM - 09:00 AM” and “09:00 AM - 10:00 AM “ and “10:00 AM - 11:00 AM” and “02:00 PM - 03:00 PM” and “04:00 PM - 05:00 PM” when he was creating a slot then when he opens the same one then I checked and disabled “08:00 AM - 09:00 AM” and “10:00 AM - 11:00 AM” and checked only(Not Disabled) “09:00 AM - 10:00 AM “and “02:00 PM - 03:00 PM” and “04:00 PM - 05:00 PM” and I want to give him an option to check/uncheck.

Please make sure that “08:00 AM - 09:00 AM” and “10:00 AM - 11:00 AM” shouldn’t be unchecked at all because these have been booked.

Given that Airblader gave you the answer to this in another forum, and given that you seem to persist in cross-posting (and re-posting) the same questions all over the web, I'm not inclined to bother mucking with this code again.

Given that Airblader gave you the answer to this in another forum, and given that you seem to persist in cross-posting (and re-posting) the same questions all over the web, I'm not inclined to bother mucking with this code again.

I have stopped cross-posting and by the way Airblader gave me the answer to a different question in another forum. Again I apologize for cross-posting.

“Old Pedant” I implemented you code in my application and it is working fine but I also want to give them an option to check/uncheck all checkboxes which are not checked and are not disabled(Should meet both conditions to check/uncheck checkboxes) and to maintain my old conditions you already met.

When a user opens an already created slot I am making all the appropriate checkboxes checked and only making the checkboxes disabled where the time has been booked.

For example if a user checked “08:00 AM - 09:00 AM” and “09:00 AM - 10:00 AM “ and “10:00 AM - 11:00 AM” and “02:00 PM - 03:00 PM” and “04:00 PM - 05:00 PM” when he was creating a slot then when he opens the same one then I checked and disabled “08:00 AM - 09:00 AM” and “10:00 AM - 11:00 AM” and checked only(Not Disabled) “09:00 AM - 10:00 AM “and “02:00 PM - 03:00 PM” and “04:00 PM - 05:00 PM” and I want to give him an option to check/uncheck.

Please make sure that “08:00 AM - 09:00 AM” and “10:00 AM - 11:00 AM” shouldn’t be unchecked at all because these have been booked.

I think you didn't get my question right here. The HTML in this case will be (For example if a user checked “08:00 AM - 09:00 AM” and “09:00 AM - 10:00 AM “ and “10:00 AM - 11:00 AM” and “02:00 PM - 03:00 PM” and “04:00 PM - 05:00 PM” when he was creating a slot then when he opens the same one then I checked and disabled “08:00 AM - 09:00 AM” and “10:00 AM - 11:00 AM” and checked only(Not Disabled) “09:00 AM - 10:00 AM “and “02:00 PM - 03:00 PM” and “04:00 PM - 05:00 PM” and I want to give him an option to check/uncheck.

Please make sure that “08:00 AM - 09:00 AM” and “10:00 AM - 11:00 AM” shouldn’t be unchecked at all because these have been booked.) :

How am I supposed to distinguish between slots that are PREVIOUSLY checked (but not disabled) and ones that the user has checked since the page was opened?

Using your last code there, say the user brings up the page, then checks the 1PM-2PM box.

How can my "check all" code tell that the 1PM-2PM box was not checked when the page was first opened?

I mean, it *can* be done, though it's a pain in the neck. But *should* it be done????

Oh, and what happens if the page indeed appears with 9AM-10AM checked, as you have it, and the user then MANUALLY UNCHECKS that slot??? Does the REMOVE it from your "protected" list of not?

You need to be more explicit about *ALL* possible operations.

First of all I don’t need “checkAll” at all.

Second of all if a slot is checked and disabled then a user shouldn’t be able to make changes to it (because it is booked now i-e in the current case “08:00 AM - 9:00 AM” or “10:00 AM - 11:00 AM”) but a user can still play with the other open slots(i-e check/uncheck other slots).