jenhuls
1/5/2017 - 5:03 PM

Gravity Forms compare fields to make sure they match.

Gravity Forms compare fields to make sure they match.

// gform_field_validation_1_91 (1 is form id, 19 is field #)
// input_7 is the field value you're comparing to
add_filter( 'gform_field_validation_1_91', function ( $result, $value, $form, $field ) {
    $master = rgpost( 'input_7' );
    if ( $result['is_valid'] && $value != $master ) {
        $result['is_valid'] = false;
        $result['message']  = 'Please enter a name.';
    }

    return $result;
}, 10, 4 );