Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 3 of 3 FirstFirst 123
Results 31 to 36 of 36
  1. #31
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,588
    Thanks
    80
    Thanked 4,497 Times in 4,461 Posts
    Quote Originally Posted by asifakhtar View Post
    First of all I don’t need “checkAll” at all.
    Then why, in post #16, did you write
    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.
    Second of all if a slot is checked and disabled then a user shouldn’t be able to make changes to it
    Yes? So? Users *CAN'T* make changes to disabled fields. JavaScript has nothing to do with this. That's fundamental HTML.

    but a user can still play with the other open slots(i-e check/uncheck other slots).
    Yes? So? Again, that's how HTML works. What does it have to do with JavaScript?

    I am utterly and completely confused.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  2. #32
    Regular Coder
    Join Date
    Feb 2009
    Posts
    121
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    Then why, in post #16, did you write


    Yes? So? Users *CAN'T* make changes to disabled fields. JavaScript has nothing to do with this. That's fundamental HTML.


    Yes? So? Again, that's how HTML works. What does it have to do with JavaScript?

    I am utterly and completely confused.
    Please see my explanation to your questions:

    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.
    By this I mean a user can still checks/unchecks other slots one by one (i-e he can check 05:00 PM - 06:00 PM which is not selected and unchecks 02:00 PM - 03:00 PM which was selected)

    Second of all if a slot is checked and disabled then a user shouldn’t be able to make changes to it
    In our current example “08:00 AM - 9:00 AM” is checked and disabled but if you check on “08:30 AM - 09:30 AM” it will uncheck “08:00 AM - 9:00 AM”.

  3. #33
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,338
    Thanks
    29
    Thanked 282 Times in 276 Posts
    Quote Originally Posted by asifakhtar View Post
    I appreicate your effort but I extended Old Pedant's solution and I want opinion from everyone here whether this is the right approach or not.
    Did my solution solve your problem or was there something wrong with it functionality-wise? If it did solve your problem, are you simply recoding it to try to learn how to code?

    As for your code (in post 26), I can't test it since you didn't provide the testing context. You haven't shown your current HTML and (complete) script with this code integrated into it. Without the rest of the script, I don't know what the this keyword is referring to.

    I will say that I think using try/catch statements is a bad idea; there's no to use exception handling to solve this problem. Ditto for using the alert method in production code; that method should only be used for testing.
    Last edited by Arbitrator; 08-26-2013 at 11:36 PM. Reason: I clarified my post after realizing more code was posted in post 28.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  4. #34
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,588
    Thanks
    80
    Thanked 4,497 Times in 4,461 Posts
    In our current example “08:00 AM - 9:00 AM” is checked and disabled but if you check on “08:30 AM - 09:30 AM” it will uncheck “08:00 AM - 9:00 AM”.
    So you should just use your PHP (or whatever) code to *ALSO* disable 8:30-9:30 !!

    Then there is NO ISSUE.

    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.
    By this I mean a user can still checks/unchecks other slots one by one (i-e he can check 05:00 PM - 06:00 PM which is not selected and unchecks 02:00 PM - 03:00 PM which was selected)
    And, again, I see no issue. You don't need any help from JavaScript to make this happen. If the checkbox is not disabled, it can be checked and unchecked by the user, at will.

    You are going to have to explain to me why you need JavaScript to support any of this. I don't see it.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  5. #35
    Regular Coder
    Join Date
    Feb 2009
    Posts
    121
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Arbitrator View Post
    Did my solution solve your problem or was there something wrong with it functionality-wise? If it did solve your problem, are you simply recoding it to try to learn how to code?

    As for your code (in post 26), I can't test it since you didn't provide the testing context. You haven't shown your current HTML and (complete) script with this code integrated into it. Without the rest of the script, I don't know what the this keyword is referring to.

    I will say that I think using try/catch statements is a bad idea; there's no to use exception handling to solve this problem. Ditto for using the alert method in production code; that method should only be used for testing.
    You code is working fine. I extended Old Pedant's code because I was already using his code. Thank you for your solution though.

  6. #36
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You might want to consider an alternative solution that uses dropdowns instead of checkboxes.

    http://jsfiddle.net/GERyX/1/

    Using dropdowns might be less confusing and more user-friendly than using checkboxes. Try it and let me know what you think.

    Note: The logic might not be perfect or way off. I implemented it the way I understand it.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


 
Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •