Results 1 to 8 of 8

Thread: "Accept terms" form submission

  1. #1
    Join Date
    Dec 2005
    Posts
    133
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Default "Accept terms" form submission

    http://www.dynamicdrive.com/dynamici...acceptterm.htm

    I love this script but I want to use a submit button that i have designed. I have the normal one and the disabled version

    can anyone help????

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    You can just give the button a class or id value and then style it however you want.

    Good luck!

  3. #3
    Join Date
    Dec 2005
    Posts
    133
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Default

    like this?
    <input name="" type="image" value="Submit!" src="images/buttons/b_continuel_disable.gif" />

    but then how will it go to the active button once I click on the checkbox?

  4. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Try:
    HTML Code:
    <input class="button" type="Submit" value="Submit!" disabled>
    Code:
    .button {
    background: url('images/buttons/b_continuel_disable.gif');
    }
    Good luck!

  5. #5
    Join Date
    Dec 2005
    Posts
    133
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Default

    ok but how do i call to show another class when button is in enable mode?

  6. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Like this:
    Code:
    .button {
      background: url('url');
    }
    .button[disabled="true"] {
      background: url('images/buttons/b_continuel_disable.gif');
    }
    Jeremy | jfein.net

  7. #7
    Join Date
    Dec 2005
    Posts
    133
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Default

    txs a lot but still it doesnt work
    I am sending you the whpole code. what is wrong????

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style>
    .buttons {color:#fff;border:1px solid #fff;background-color:#b46f02;}/*enable button must be in orange with white text*/
    .buttons[disabled="true"] {color:#fff;background-color:#dcd5c0;}/*disable button must be in gray with white text*/
    </style>

    <script>

    //"Accept terms" form submission- By Dynamic Drive
    //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
    //This credit MUST stay intact for use

    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
    }
    }
    }

    function defaultagree(el){
    if (!document.all&&!document.getElementById){
    if (window.checkobj&&checkobj.checked)
    return true
    else{
    alert("Please read/accept terms to submit form")
    return false
    }
    }
    }

    </script>
    </head>

    <body>
    <form name="agreeform" onSubmit="return defaultagree(this)">
    Rest of your form here<br>
    <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)"><b>I agree to the above terms</b><br>
    <input class="buttons" type="Submit" value="Submit!" disabled>
    </form>

    <script>
    //change two names below to your form's names
    document.forms.agreeform.agreecheck.checked=false
    </script>

    </body>
    </html>

  8. #8
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Sorry, do this:
    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style>
    .buttons {color:#fff;border:1px solid #fff;background-color:#b46f02;}/*enable button must be in orange with white text*/
    .buttons[disabled="true"], .buttons[disabled] {color:#fff;background-color:#dcd5c0;}/*disable button must be in gray with white text*/
    </style>
    
    <script>
    
    //"Accept terms" form submission- By Dynamic Drive
    //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
    //This credit MUST stay intact for use
    
    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
    }
    }
    }
    
    function defaultagree(el){
    if (!document.all&&!document.getElementById){
    if (window.checkobj&&checkobj.checked)
    return true
    else{
    alert("Please read/accept terms to submit form")
    return false
    }
    }
    }
    
    </script>
    </head>
    
    <body>
    <form name="agreeform" onSubmit="return defaultagree(this)">
    Rest of your form here<br>
    <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)"><b>I agree to the above terms</b><br>
    <input class="buttons" type="Submit" value="Submit!" disabled>
    </form>
    
    <script>
    //change two names below to your form's names
    document.forms.agreeform.agreecheck.checked=false
    </script>
    
    </body>
    </html>
    Jeremy | jfein.net

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
  •