• Resolved redair

    (@redair)


    Hi.

    I have 2 fields that is textfields. I have to verify that that the content of #2 is the same as #1. Also, the content of #2 not stored. Just for verification purpose.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter redair

    (@redair)

    Anyone have an idea?

    Plugin Author Shabti Kaplan

    (@shabti)

    Try placing this inside your function.php file. You have to replace $field_key with your field key.

    add_filter( 'acf/validate_value/key=field_key_1', function( $is_valid, $value, $field, $input ){
            if( $value == acf_extract_var( $_POST['acf'], 'field_key_2' ) ){
                return $is_valid;
            }else{
                return __( 'The values do not match.' );
            }
    }, 5, 4);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Validate field #2’ is closed to new replies.