+ Reply to Thread
Results 1 to 3 of 3

Thread: ABVFP Check Box
      
   

  1. #1
    greyhame is offline Sergeant
    Join Date
    Jun 2006
    Posts
    38

    Default ABVFP Check Box

    Can someone tell me how I can validate whether a checkbox is checked when a form is submitted. I have a form for users to sign up for a newsletter. Users must agree to a statement in the form by checking the box. I would like to be able to reject the form if it is unchecked. Thanks.
    No matter how fast you are going, there is always someone trying to pass.

  2. #2
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,060

    Default Re: ABVFP Check Box

    This is usually done using Javascript, before the form info is even submitted. Here is my preferred method. I use it because it will not get in conflict with BV's own form fields validation, so you can use both in the same form.

    We will suppose that you are using a standard BV form, named Form1. If the name is different, change the part in RED to be the same as the form name. We will also suppose that the checkbox is named "agree". If not, change the part in BLUE to be the same as the checkbox name:

    Step 1. Paste the following code in the "Between head Tag" of your 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/accept terms to submit form")
    return false
    }
    }
    }
    </script>
    Step 2. Right Click on the form, select HTML, and paste the following code in the AFTER TAG of the form html:

    <script>
    //change two names below to your form's names
    document.forms.Form1.agree.checked=false
    </script>
    Step 3. Right Click on the checkbox, select HTML, and paste the following code in the INSIDE TAG of the checkbox HTML:

    onClick="agreesubmit(this)"
    Step 4. Right click on your Submit button, select HTML, and paste the following code in the Inside Tag of the Submit button HTML:

    disabled
    That's all.

    This script is presented at http://www.dynamicdrive.com/dynamici...acceptterm.htm

    I just show here how to use it with a BV form.

    To see it working, visit http://www.dbtechnosystems.com/Tips/Agree_to_Terms.html
    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!


  3. #3
    greyhame is offline Sergeant
    Join Date
    Jun 2006
    Posts
    38

    Default Re: ABVFP Check Box

    Greatly appreciated! This disables the submit button until the agree box is checked.
    No matter how fast you are going, there is always someone trying to pass.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49