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.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    multi select checkboxes.

    Hi, i'm looking to make a JS that will let users select multiple checkboxes. I want to be able to hold down shift, click a checkbox, hold shift again, click another checkbox, and then, all the checkboxes between the two that i clicked should be checked. Can someone help me out with the script for that? I would really appreciate it.







    I'm sure this shouldn't be too hard to whip up in JS.
    1. Make sure each input field is <input type="checkbox" order="1" ...>,
    where order is sequential from 1 down the page
    2. Add JS so on each 'onclick', it keeps track of 'order' item of the last
    clicked checkbox
    3. If the click has shift held down, make sure you check/uncheck everything
    between the last clicked on checkbox (as saved in step 2) and the current
    checkbox. Since they're sequential, easy to do, just count up or down
    towards the current one.

    Keith

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Question: Do you want it to check everything if the current checkbox is unchecked and uncheck everything if the current box is checked or simply check everything that's currently unchecked and uncheck everything that's currently checked?
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What do you think of this?

    Let me know if you want to use it.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #4
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hey beetle,
    that is great. wonderful.. didnt even think of something like that..
    Would you consider letting me use it?
    I would also like something like what my boss suggested though..
    Here's the scenario i am thinking of..
    i want to be able to select groups of checkboxes.
    If i hold shift, and click a box.
    Then, i go down the list, and hold shift, and click another box,
    all the boxes between the two that i clicked should also be checked.

    The reverse should also be possible.
    (hold shift, and select 2 boxes, and everything between gets unchecked)

    Anyone have any ideas?
    Thanks,
    Keith

  • #5
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi beetle, is there any other way that i can contact you? via email perhaps, so you can give me permisson to use your script?
    Thanks

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh, sorry. Yes, you have my permission - but you can always use my website to contact me. Better not pursue that career as a detective (j/k )
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”


  •  

    Posting Permissions

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