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 Form Validation

  1. visions
    Member

    Hello

    I have a site where users earn commissions through referral of ad placements
    Once their commission gets up to $25 they can choose to redeem their commission through issuance of gift vouchers.

    I'm using Gravity forms for them to fill out a form to request to redeem their commission.

    In the form they can select 2 stores that they want a gift voucher for and then enter the value they want to spend in each store.

    The problem is that I need to validate the form so the total amount of these 2 fields is not greater than their total commission balance which is passed to the form through a $_GET value.

    eg. If my commission balance is $40.00, then the combined total of the 2 fields can't be more than 40

    I am embedding my form into a page template using do_shortcode

    echo do_shortcode(" [gravityforms id=7 title='false' description='false' field_values='commission_value=".$_GET['balance'].");

    Can you give any advice on how I can hook into the form validation to validate these fields?

    Posted 7 years ago on Tuesday February 26, 2013 | Permalink
  2. If you have the commission amount stored in a form field with a parameter name of "commission_value", you will need to compare the amounts which were entered to the value of this field. Without knowing what field IDs you are using, it's hard to give you the code to do this. However, you would use the gform_validation hook to compare all the values, and return a validation error after the form is submitted, if the amounts exceed the commission balance.

    http://www.gravityhelp.com/documentation/page/Gform_validation

    Posted 7 years ago on Tuesday February 26, 2013 | Permalink
  3. visions
    Member

    Thanks, I think I should be able to work it out from that

    Posted 7 years ago on Tuesday February 26, 2013 | Permalink
  4. Please let us know if you get stuck. We'll be happy to help.

    Posted 7 years ago on Tuesday February 26, 2013 | Permalink