Results 1 to 3 of 3

Thread: how can i define the checkvalue on?

  1. #1
    Join Date
    Jan 2012
    Posts
    52
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Question how can i define the checkvalue on?

    i.e the form submit will be successful when the check-box is on. such as only when i am agree to the terms and conditions is checked.

  2. #2
    Join Date
    Jan 2012
    Location
    India
    Posts
    45
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default

    Show your code, you can do this easily through javascript Have you tried it yourself?

  3. #3
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    Here's a script that disables the submit button unless the checkbox is checked. You can probably adapt it to your needs. Can't remember were I found it...

    NOTE: This is not secure. Someone with knowledge of javascript could easily undisable the submit button. If you want it to be secure, you will have to use a server side language.

    HTML Code:
    <html>
    <head>
    <script>
    var checkobj
    function agreesubmit(el){
    checkobj=el
    if (document.all||document.getElementById){
    for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
    var tempobj=checkobj.form.elements[i]
    if(tempobj.type.toLowerCase()=="submit")
    tempobj.disabled=!checkobj.checked
    }
    }
    }
    </script>
    </head>
    <body>
    <form>
    <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)">I agree to the terms and conditions</a><br>
     <input type="submit" name="submit" value="Register" disabled="true">
     </form>
     </body>
     </html>

Bookmarks

Posting Permissions

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