Checkbox problem on paypal form

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Aliens Anonymous
    Special Status

    • Jan 2006
    • 1144

    Checkbox problem on paypal form

    Hi Dudes
    having a bit of a mare making checkbox's required. as bv has not got the option on the builder i take it, it requires javascript. when you publish a bv page it makes the script for you for text, combos, etc boxs in the form of a script like this.

    HTML Code:
    if (theForm.Editbox8.value == "")
    {
    alert("Please enter a value for the \"Email\" field.");
    theForm.Editbox8.focus();
    return false;
    }
    this being, i edited the html page and added the script

    HTML Code:
    if (theForm.Checkbox1.value == "")
    {
    alert("You have not checked the \"item name\" field.");
    theForm.Checkbox1.focus();
    return false;
    }
    But still no go, in the first checkbox i have a value of phpbb Insulation this so paypal know what it is. but i found the if i changed value =="") to value =="phpbb Insulation") the warning would work but because you can't wright text in to a checkbox i could not fill the field so that did not work.
    My question is there a way to have the checkbox be required if so were am i going wrong. if no then DAMN. and thanks anyway.

    One of the forms is Here
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: Checkbox problem on paypal form

    Well, the logic is correct. But, since, as you have crrectly stated, the checkbox has already a value, you need to check if it is checked or not, and this is done by defining and examining (with Javascript) the value of the "Form.checkbox.checked" variable.

    I will assume here that no other fields are required, so the function i will show you is a standalone, only for this checkbox. If more fields are required, or your form has also other types of validation, you must modify the script.


    I am assuming that you are using BV, so the form, if it is the first form in the page, will have the default name "Form1" and let's also suppose that the checkbox has the name "check".

    Here is what you need to do:

    1. Paste this function code in the Page Between Head:

    <script language="JavaScript" type="text/javascript">
    <!--
    function ValidateForm1(theForm)
    {
    if (theForm.check.checked==false)
    {
    alert("Please check the \"Checkbox\" field.");
    return false;
    }
    return true;
    }
    //-->
    </script>



    2. Paste this script in the Form html INSIDE TAG:

    onsubmit="return ValidateForm1(this)

    3. Paste his code in the Form html AFTER TAG:

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

    Check out the validation at http://www.dbtechnosystems.com/Tips/..._checkbox.html

    As you see, it uses part of the same script that you have used for the "Agree to Terms" checkbox.

    One question: Form Insulation ? !!!? you mean Forum Installation ?
    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

    • Aliens Anonymous
      Special Status

      • Jan 2006
      • 1144

      #3
      Re: Checkbox problem on paypal form

      Well you have come up trumps agian had a bit of touble because of other validated field had a lot of trouble with the tag item you gave checkbox kept flying off the page, but i found that if i edited the html page it's self and adding part of the head script you gave i found it worked as i wanted

      HTML Code:
      if (theForm.item_name.checked==false)
      {
         alert("You have not checked the \"Item\" Box.");
         return false;
      }
      if (theForm.amount.checked==false)
      {
         alert("You have not checked the \"Amount\" Box.");
         return false;
      }
      So thanks to you i can now continue Thanks alot for your help.

      One question: Form Insulation ? !!!? you mean Forum Installation ?
      Yes your right there got so rapped up in the checkboxs that i had not noticed

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #4
        Re: Checkbox problem on paypal form

        This is the reason that i usualy do NOT use the BlueVoda validation. I prefer a php preview / validation page where i can perform ANY type of validation, and from there create my PayPal button and send the visitor to payment.
        When i need Javascript validation, i usually create my code myself and add it in the page
        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

        Working...
        X