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.

Validate field based on entry of another field

  1. paddelboot


    How is it possible to write a custom validation rule for a form field based on the value entered in another field within the same form?

    Example: Startdate and enddate, enddate shouldn't be before startdate.

    Regards, don't get flooded,


    Posted 7 years ago on Monday October 29, 2012 | Permalink
  2. You can. Use the gform_validation hook to do the validation for you, then do your comparison in php (in your theme's functions.php) and if there is an error, return the error with your error message.

    Posted 7 years ago on Monday October 29, 2012 | Permalink
  3. paddelboot

    I was too focused on the entry object. I forgot I can just use the $_POST data to compare any fields.


    Posted 7 years ago on Tuesday October 30, 2012 | Permalink
  4. Glad you got that working. Thanks for the reply.

    Posted 7 years ago on Wednesday October 31, 2012 | Permalink

This topic has been resolved and has been closed to new replies.