Results 1 to 5 of 5

Thread: Accept Terms submit button adding??

  1. #1
    Join Date
    Jun 2008
    Posts
    21
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Accept Terms submit button adding??

    Hi there,

    I recently added the script mentioned below
    "Accept terms" form submission.

    Now I would like to add two diffent button styles to my submit button.
    First when the button is Enabled the class is called style1
    Secnd when the button is Disabled the class is called style1_alt

    Is this possible to add to the script show in that tutorial?

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Add the highlighted:
    Code:
    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
    tempobj.className=(tempobj.disabled==true)?'style1_alt':'style1';
    }
    }
    }
    Make sure you have declared it in your CSS already:
    Code:
    .style1{background:#eee;}
    .style1_alt{background:#fc0;}
    See if it helps.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Jun 2008
    Posts
    21
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Quote Originally Posted by rangana View Post
    Add the highlighted:
    Code:
    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
    tempobj.className=(tempobj.disabled==true)?'style1_alt':'style1';
    }
    }
    }
    Make sure you have declared it in your CSS already:
    Code:
    .style1{background:#eee;}
    .style1_alt{background:#fc0;}
    See if it helps.
    Thank you for the advice. . . Inplimented this script, but one issue occurs during this process when I check the checkbox, it seems to change all my other elements (like my input boxes and dropdown boxes) class (CSS style for input elements) field. So it change any field in the form that has a class attached to it. Can you tell me why this is?

  4. #4
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    See if enclosing them in a bracket helps:
    Code:
    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
    tempobj.className=(tempobj.disabled==true)?'style1_alt':'style1';}
    }
    }
    }
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  5. #5
    Join Date
    Jun 2008
    Posts
    21
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Quote Originally Posted by rangana View Post
    See if enclosing them in a bracket helps:
    Code:
    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
    tempobj.className=(tempobj.disabled==true)?'style1_alt':'style1';}
    }
    }
    }
    That solveed the issue encapsulating it Thank you sooo much

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
  •