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.

validation rules that use answers from previous fields?

  1. sydeburn
    Member

    Is it possible to build validation rules that use answers from previous fields?

    For example, q1 asks "how many days per week does your program meet?". q2 then asks "of those, how many days do you x?". I need validation on q2 that the answer be less than the value of q1. Is this possible? I looked at your gform validation hook but I can't tell if this would be possible.

    Posted 7 years ago on Thursday November 29, 2012 | Permalink
  2. It's not possible to do it in the form builder. You can do it with the gform_validation filter though. You would compare the $_POST value for the field where the answer to q1 exists to the value for the field of q2 to make sure that q2 is less than q1. It can be done using the gform_validation filter and a function in your theme's functions.php.

    Posted 7 years ago on Thursday November 29, 2012 | Permalink
  3. sydeburn
    Member

    ok, thanks.

    Posted 7 years ago on Tuesday December 4, 2012 | Permalink

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