PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Custom validation script - Error on multi-page form

  1. I followed this tutorial to calculate and validate against a person's age using a date picker field: http://www.gravityhelp.com/forums/topic/check-date-greater-than-18-yrs

    The problem is I am using a multi-page form and the date of birth field I am using is on the second page. When the script executes I am getting a validation error message at the top of the first page, but no field is highlighted below as containing an error.

    When I remove the age validation script, I can proceed past page one just fine.

    The script otherwise runs successfully. How can I modify the script to only execute on the page that contains the DOB field?

    Thank you!

    Posted 6 years ago on Thursday March 14, 2013 | Permalink
  2. Also the date field is returning the date in mm/dd/YYYY format, instead of YYYY-mm-dd:
    $field_id = 7;
    $dob = rgpost('input_'.$field_id);

    Is there a way to get the date in the YYYY-mm-dd format or do I need to modify the script to read the mm/dd/YYYY format?

    Posted 6 years ago on Thursday March 14, 2013 | Permalink
  3. Do you mean you're using this code specifically?
    http://www.gravityhelp.com/forums/topic/check-date-greater-than-18-yrs#post-123741

    Please see this documentation for using gform_validation on multi-page forms:
    http://www.gravityhelp.com/documentation/page/Using_the_Gravity_Forms_%22gform_validation%22_Hook

    The form we we re working with previously was a single page form.

    Line 19 is where you would modify the date format in this code:
    http://pastebin.com/Rz9hurZt

    The date format you use in the script should match the date format used in the form.

    Posted 6 years ago on Sunday March 17, 2013 | Permalink