Menu

Form Validation Problems in Joomla

Help
2010-11-16
2013-06-03
  •  SproutCreatives

    SproutCreatives - 2010-11-16

    My web form will not validate for the required fields. It sends the results email correctly, the captcha works fine. Every thing about the form works except for required fields can be left empty upon submission. Maybe Joomla has something to do with it. Any help would be appreciated.

     
  • TNTEverett

    TNTEverett - 2010-11-17

    First you need to verify the form has been generated properly becuase there are some bugs that occur in certain cases during generation. 

    Find each field name for the required fields.
    Look at the bottom of the form.html file for this section:
    <SCRIPT type=text/javascript>
    <!-
    function validatePage3()
    {
    retVal = true;
    if (validateField('field_24','fieldBox_24','checkbox',0) == false)
    retVal=false;
    if (validateField('field_25','fieldBox_25','checkbox',0) == false)
    retVal=false;
    if (validateField('field_26','fieldBox_26','checkbox',0) == false)
    retVal=false;
    if (validateField('field_27','fieldBox_27','checkbox',0) == false)
    retVal=false;
    if (validateField('field_28','fieldBox_28','menu',0) == false)
    retVal=false;
    if (validateField('field_29','fieldBox_29','menu',0) == false)
    retVal=false;
    if (validateField('field_30','fieldBox_30','checkbox',0) == false)
    retVal=false;
    if (validateField('field_33','fieldBox_33','textarea',0) == false)
    retVal=false;
    if(retVal == false)
    {
    alert('Please correct the errors.  Fields marked with an asterisk (*) are required');
    return false;
    }
    return retVal;
    }
    //->
    </SCRIPT>

    The "0" or "1" in these lines determines "required" or not.
    NOT REQUIRED
    if (validateField('field_33','fieldBox_33','textarea',0) == false)
    REQUIRED
    if (validateField('field_33','fieldBox_33','textarea',1) == false)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.