check box..making it required?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • chadzog
    Sergeant

    • Oct 2006
    • 34

    check box..making it required?

    How do you make a check box a required field? What I'm trying to do is make it required (for the agreement of the terms and conditions of my website) before the customer hits the "submit" button. You can prepopulate the box, but I would rather them check it. Any other ideas would be helpful.
    The website is www.kansascitybathroomremodeling.com if you would like to see 1st hand.

    Thanks for your help

    Chad
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: check box..making it required?

    It is easy.

    Place the checkbox in your form. Right click it, HTML, and psate the following in the Inside Tag:

    onClick="agreesubmit(this)"

    Now, right click the form in a position where there is nothing. Select HTML and paste the following in the After Tag:

    <script>
    //change the name below to your form's names
    document.forms.Form1.agree.checked=false
    </script>


    Last:

    Paste the following code in the Between Head Tag of the Page html:

    <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 and accept the Terms and Conditions to install the script!")
    return false
    }
    }
    }
    </script>

    Form1 is the Form ID, if it is diferent, change accordinly. "agree" is the checkbox name, if it different, change the script accordingly.

    This is a script from Dynamic Drive adapted to a BV form.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment

    • chadzog
      Sergeant

      • Oct 2006
      • 34

      #3
      Re: check box..making it required?

      thanks for your help. i'll give her a shot

      Comment

      Working...
      X