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. I'm using the authorize.net add-on and trying to set a minimum amount on a user defined price field. I'm trying to set the minimum amount to enter as $10 but for some reason its not working. Here's the code I'm using:

    // Set minimum amount on cc form to be $10
    add_filter("gform_field_validation_51_7", "custom_validation", 10, 4);
    function custom_validation($result, $value, $form, $field){
    
        if($result["is_valid"] && intval($value) < 10){
            $result["is_valid"] = false;
            $result["message"] = "The minimum payment must be more than $10";
        }
        return $result;
    }

    Here's a link to the form: https://www.intouchamerica.com/online-payment/

    Is there something I'm missing?

    Thanks

    Posted 5 years ago on Friday May 24, 2013 | Permalink
  2. The problem is that the $value variable actually includes the number format as well, so you need to convert it to just a number first, then use that new variable in the comparison. Take a look at this example: http://pastie.org/7955512

    Posted 5 years ago on Friday May 24, 2013 | Permalink