Hi ma i please ask why this code wont work?
It goes to an error page like this: https://www.screencast.com/t/qqJMxrwZY
Instead of telling the v_field_2 that it cannot accept content because the v_field_1 is not empty or already set. TIA
// Test Validation
add_filter(‘acf/validate_value/name=v_field_2’, ‘my_acf_validate_value’, 10, 4);
function my_acf_validate_value( $valid, $value, $field, $input ){
// bail early if value is already invalid
if( !$valid ) {
return $valid;
}
if( get_field(‘v_field_1’) != “” ) {
$valid = ‘Field 1 is already filled up’;
}
// return
return $valid;
}
The cause of the error page being shown can be caused by either a JavaScript error or an error in PHP during the AJAX request.
For JS errors see if you see any errors reported in console.
To check for PHP errors see error logging here https://codex.wordpress.org/WP_DEBUG
Hi upon checking it doesnt show any error. on both js and php