Hi there,
I have created, for me, quite a complicated form for a loan company. I have a number of validations in my functions.php file but I have one that I am struggling with.
I have a field (18) that is a text field and an address field (15). I want to compare field 18 with the first 2 characters of the first line of field 15 (15.1).
I am trying something like this but cannot seem to get it to work:
add_filter( 'gform_field_validation_1_18', function ( $result, $value, $form, $field ) {
$address1 = rgar( $entry, '15.1' );
$house_number = substr( $address1, 0, 2);
if ( $result['is_valid'] && $value == $house_number ) {
$result['is_valid'] = false;
$result['message'] = 'I think you may have entered your house number in this box. Please enter how long you have lived at this address. If the number is correct please add the word YEARS and the resubmit the form';
}
return $result;
}, 10, 4 );
I would appreciate some assistance if possible.
Many thanks,
Ian