Error on Required Fields - HELP?

Help
2010-08-31
2013-06-03
  • Alison Rigby
    Alison Rigby
    2010-08-31

    I have a tiny bit of PHP experience, but thought using the form generator would save me trying to create my own form. I've uploaded the form, and get the following error every time I try to submit it to test:

    " Please correct the errors. Fields marked with an asterisk (*) are required." I'm filling in my required fields, even tried filling in ALL the fields, but still get the same error. The form is located at:

    http://www.wildpaths.co.tz/form1.html

    I'd sure appreciate any help, our deadline was today so I'm behind the 8-ball.

    Thank you!

     
  • TNTEverett
    TNTEverett
    2010-08-31

    The bottom of your form.html file has code that looks like this:
    retVal = true;
    if (validateField('field_1','fieldBox_1','menu',1) == false)
    retVal=false;
    if (validateField('field_2','fieldBox_2','text',1) == false)
    retVal=false;
    if (validateField('field_3','fieldBox_3','textarea',1) == false)
    retVal=false;
    if (validateField('field_4','fieldBox_4','radio',1) == false)
    retVal=false;
    if(retVal == false)
    {
    alert('Please correct the errors.  Fields marked with an asterisk (*) are required');
    return false;
    }

    The "1" at the end of every validateField() function means "required".  Make sure the "1"'s match what you expect.  If a field is NOT required change the "1" to a "0". 

     
  • Alison Rigby
    Alison Rigby
    2010-08-31

    Thank you for your quick response. I have checked and double-checked that. From source view you will see that the first 8 fields are required, the rest are not. This is what I want, but it still wont work. What else might be the problem?

    Also, to clarify for myself, another question: what about the "true" and "false" values? For a required field, should it be like this:

    if (validateField('field_2','fieldBox_2','text',1) == true)
    retVal=true;

    This is an edit I made to a local version while trying to fix the errors. It did not work. The original looks like this:

    if (validateField('field_2','fieldBox_2','text',1) == false)
    retVal=false;

    Thanks again!

     
  • TNTEverett
    TNTEverett
    2010-08-31

    You need to troubleshoot each field separately.  Add the following to your validation script functions:

    if (validateField('field_2','fieldBox_2','text',1) == false) {
    alert('Field 2 Failed');
    retVal=false;
    }

    All functions should have "== false".
    All functions should have "retVal=false;".

     
  • Alison Rigby
    Alison Rigby
    2010-09-05

    Hi again, thanks for your help. So, I used the code above to troubleshoot the form, and it turns out that the CALENDAR fields are causing the "required field" errors. They error whether I enter dates in them or not. What help can you provide me on this, please?

    Thanks!