Hello,
Can you share the code that creates the group field? You should add the subfield ID to the remote validation. Here is an example:
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
function your_prefix_function_name( $meta_boxes ) {
$meta_boxes[] = [
'title' => __( 'My Post Meta1', 'your-text-domain' ),
'id' => 'my-post-meta1',
'fields' => [
[
'name' => __( 'Group', 'your-text-domain' ),
'id' => 'group',
'type' => 'group',
'fields' => [
[
'name' => __( 'Text', 'your-text-domain' ),
'id' => 'text',
'type' => 'text',
],
],
],
],
'validation' => [
'rules' => [
'text' => [
'remote' => admin_url( 'admin-ajax.php?action=my_action1' )
]
],
'messages' => [
'text' => [
'remote' => __( 'test remote validation', 'your-text-domain' )
]
],
],
];
return $meta_boxes;
}
add_action( 'wp_ajax_my_action1', function () {
if ( $_GET['text'] === 'something' ) {
echo 'true'; // Valid
} else {
echo 'false'; // Invalid
}
die;
} );