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.

validating using gform_validation_Hook

  1. SqueezeDigltal
    Member

    Hi,
    I followed your documentation for the validation hook and have got it working for one field, thanks.
    My form has about 20 fields that need custom validation, would i need to re-write the entire code for each field?

    Posted 13 years ago on Thursday August 11, 2011 | Permalink
  2. Does the same validation need to apply to each field? Please post more details of your setup, and the code you are using for validation. Thanks.

    Posted 13 years ago on Thursday August 11, 2011 | Permalink
  3. SqueezeDigltal
    Member

    Each field has different validation.
    You can see 2 here: http://pastie.org/2360402
    So if i continue down this road i will keep repeating the same code 20 times but with a different function for each. Is there are cleaner, less cumbersome way of doing this?
    My form is a 4 page form and can be found: http://dev.wantapaydayloan.co.uk/apply-now/
    Thanks.

    Posted 13 years ago on Friday August 12, 2011 | Permalink
  4. Is the validation for each of your 20 fields different, the same, or a mix? If it's the same you could write a reusable function that you use when validating a field. You should be able to use the gform_validation hook to validate multiple fields at once, it all depends on how you write the code.

    Posted 13 years ago on Friday August 12, 2011 | Permalink