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.

Simple form validation

  1. Hello, I'm trying to find a very easy way of validating a discount code on my site. It won't need to be a required field (as most users won't have a code), but I do need the user to enter the correct code otherwise it should say "invalid code". At the moment I am only using one code but I may need to use more in the future.

    I'm not that great at PHP so am hoping there is a simple solution out there!

    Many thanks.

    Posted 11 years ago on Monday March 11, 2013 | Permalink
  2. rcDev
    Member

    Pretty sure you'll need to use PHP. Use the *gform_field_validation* hook:
    http://www.gravityhelp.com/documentation/page/Gform_field_validation

    Here is some example code to put in your *functions.php* file:
    http://pastebin.com/fUbgVqbh

    Posted 11 years ago on Monday March 11, 2013 | Permalink
  3. Thanks very much - I'll give it a try (gulps).

    Posted 11 years ago on Monday March 11, 2013 | Permalink