I’m trying to implement a validation across two fields where a user is required to enter their Parent/Guardian’s email address as well as their own.
The purpose of validation is to ensure the same email address is not entered in both fields.
I have narrowed down what seems to be what I need … but I can’t work out where and how to implement/call it. It has been added to the functions.php file within the Child theme (or does it need to go in the main theme?)
add_filter( 'gform_field_validation_1_5' , function ( $result , $value , $form , $field ) {
$master = rgpost( 'input_21' );
if ( $result [ 'is_valid' ] && $value == $master ) {
$result [ 'is_valid' ] = false;
$result [ 'message' ] = 'Please enter a different email.' ;
}
return $result ;
}, 10, 4 );
