Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'gform_field_validation_1_22', 'gf_user_defined_price_validation', 10, 4 );
- function gf_user_defined_price_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, '' );
- GFCommon::log_debug( __METHOD__ . '(): User Defined Price Submitted: ' . $number );
- if ( $result['is_valid'] && $number < 5501 ) {
- $result['is_valid'] = false;
- $result['message'] = 'You must enter less than $5500.00';
- }
- return $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement