Hello all, I am trying to use the price field validation function found on GF’s Docs for a client’s silent auction: https://docs.gravityforms.com/gform_field_validation/#2-price-field-validation
The page is here: https://www.citylightsgallery.org/donate.
The form is directly under the video clip “We will make it.” The price field, “Your Bid,” which is revealed when you check “I want to place a bid,” should have a minimum value of $2,500.00.
This is my adaptation of the price field validation in the functions file:
/* Gravity Forms Minimum Amount */
add_filter( 'gform_field_validation_116_1', 'custom_validation', 10, 4 );
function custom_validation( $result, $value, $form, $field ) {
//change value for price field to just be numeric (strips off currency symbol, etc.) using Gravity Forms to_number function
//the second parameter to to_number is the currency code, ie "USD", if not specified USD is used
$number = GFCommon::to_number( $value, '' );
$form = 8;
$field = 1;
if ( $result['is_valid'] && intval( $number ) < 2500 ) {
$result['is_valid'] = false;
$result['message'] = 'You must enter at least $2,500.';
}
return $result;
}
I tested the form by entering a bid of $1.00 and it went right through. What am I missing?