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.

User defined price with minimum amount

  1. Hello,

    I am trying to setup a custom validation for the user defined price. I followed this code example in the documentation and haven't been able to get it to work correctly (it returns an error no matter what). http://www.gravityhelp.com/documentation/page/Gform_field_validation

    Here is an example where we need to have a minimum donation amount of $3,000: http://templedavid.org/jason-z-edelstein-endowment-fund-bricks/

    My code in functions.php:

    add_filter("gform_field_validation_12_1", "custom_validation3", 10, 4);
    function custom_validation3($result, $value, $form, $field){
    
        if($result["is_valid"] && intval($value) < 3000){
            $result["is_valid"] = false;
            $result["message"] = "You must donate at least $3,000 to be eligible for a brick.";
        }
        return $result;
    }

    Any ideas on how I can make this work? Maybe it has something to do with the field being a dollar amount?

    Thanks!

    Posted 11 years ago on Tuesday April 16, 2013 | Permalink
  2. We updated the gform_field_validation page to include an appropriate example of this:

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

    Posted 11 years ago on Wednesday April 17, 2013 | Permalink

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