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 12 of 12

Thread: checkboxes

  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question checkboxes

    Does anyone have any javascript or vbscript code that allow the user select one checkbox at the time...if the user select another checkbox then first one will be unchecked??? Thanks.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    clu...
    ummm whyyy just a rent® ya using 'radio' instead???

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    just a ps®...
    /me just a found® thisss piece of 'coding' from jkd...:O)))
    just a copied/pasted/saved/credited® (September 24, 2000 10:35:14 PM)...hehehe...

    Code:
    <form name="myform" action="bla">
                        <input type="checkbox" name="checker">
                        <input type="checkbox" name="checker">
                        <input type="checkbox" name="checker">
                        <input type="checkbox" name="checker">
                        <input type="checkbox" name="checker">
                        <input type="checkbox" name="checker">
                        <input type="checkbox" name="checker">
                        <input type="checkbox" name="checker">
                        <input type="checkbox" name="checker">
                        <input type="checkbox" name="checker">
                        </form>
    
                        <script>
                        <!--//
                        function validateIt() {
                        checkCount=0
                        for (i=0;i<=9;i++) {
                        if (document.myform.checker[i].checked) {
                        checkCount++
                        }
                        }
                        if (checkCount==6) {
                        document.forms.myform.submit()
                        }
                        else if (checkCount!=6) {
                        alert("You can only select 7 options.")
                        }
                        }
                        //-->
                        </script>
    thattt just a lets® the viewer select '7' outta the 9...:O))) sooo mayyybe ya can just a lter® it to suit your needs???

  • #4
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks. I did use a Radio button...people here don't like it. They just want to make my life a bit miserable

  • #5
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hahaha, it is NOT working. It lets me select all 10 checkboxes.

  • #6
    Regular Coder
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool

    This should be what you're looking for.
    Attached Files Attached Files

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    clu...
    just a sorrry® 'bout that...:O((( /me just a took® jkd's post for doing whattt it just a should® ...lol...hes just a one® of the bestest here in the forum...
    'cept /me noticed ya just a said® ten...
    hmmm...did ya just a try® deletin' one of these lines??? ...
    <input type="checkbox" name="checker">

    mayyybe thattts what just a caused® it NOT to work...:O(((

  • #8
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, Skyzyx. Yes, that is what I am looking. BUT, your code is too dynamic. I am using a regular html code inside of a loop:

    example:
    <form name="test" action="submit">
    <% for each ChildNode in ChildNodes%>
    <input type="checkbox" name="avdelete">
    <%next %>

    </form>

  • #9
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    justame ......" hmmm...did ya just a try® deletin' one of these lines??? ... " YES, I want to delete one out of these lines

  • #10
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    <html>
    <head>
    <script>
    <!--//
    function uncheckOthers(checkedbox) {
    for (i=0;i<=9;i++) {
    if (checkedbox!=document.myform.checker[i])
    document.myform.checker[i].checked=false;
    }
    }
    //-->
    </script>
    </head>

    <body>
    <form name="myform" action="bla">
    <input type="checkbox" name="checker" onclick="uncheckOthers(this);">
    <input type="checkbox" name="checker" onclick="uncheckOthers(this);">
    <input type="checkbox" name="checker" onclick="uncheckOthers(this);">
    <input type="checkbox" name="checker" onclick="uncheckOthers(this);">
    <input type="checkbox" name="checker" onclick="uncheckOthers(this);">
    <input type="checkbox" name="checker" onclick="uncheckOthers(this);">
    <input type="checkbox" name="checker" onclick="uncheckOthers(this);">
    <input type="checkbox" name="checker" onclick="uncheckOthers(this);">
    <input type="checkbox" name="checker" onclick="uncheckOthers(this);">
    <input type="checkbox" name="checker" onclick="uncheckOthers(this);">
    </form>
    </body>
    </html>

  • #11
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    BIG THANKS! THAT'S IT!!!!

  • #12
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    arn...
    just a tas® for /mes 'newest' just a copied/pasted/credited/saved® text file...:O)))


    sky...
    just a tas® for yourrr solution tooo...:O)))
    /me has it stored tooo incase someone is just a looking® for as clu said...just a dynamic® solution...:O)))


  •  

    Posting Permissions

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