I have been working on a function and the validation is to ensure that input in the field is exactly what is in the $cash variable defined, i succeeded in using greater than function but this allows values greater than what the user has, so it does not get exact figure of what the user has, if user cash is 300 then anything above 300 is valid and okay, but i want the validation to be strictly on the value exactly.
add_filter( 'gform_field_validation_9_7', 'custom_validationc', 10, 4 );
function custom_validationc( $result, $value, $form, $field ) {
$current_user = wp_get_current_user();
$number = $current_user->USERPIN2;
if ( $result['is_valid'] && $value < $number ) {
$result['is_valid'] = false;
$result['message'] = 'You must enter exactly the amount on your cash balance.';
}
return $result;
}
My problem is that i want the exact value of $cash not by using greater than functions. And i have tried $value === $cash - But nothing works. only works when i use the greater than function or less than function for validation.