I’ve had the same problem as well and found a way to solve it without hacking either this plugin or CF7.
It stems from the CF7 update which began using a new REST API for validating the fields. It returns a field wrapper class (span.wpcf7-form-control-wrap
) that the script uses to find the field and display the resulting validation message. The CF7BS plugin does not use this class in its field group wrappers, and hence the messages are not displayed.
To fix this, add this code to your theme’s functions.php:
// BEGIN CF7BS validation messages hotfix
function filter_cf7RestResponse( $response, $result ) {
// Quits processing if validation passed
if ( 'validation_failed' != $result['status'] )
return $response;
// Alters wrapper classes in every field
foreach ( $response['invalidFields'] as &$field ) {
$field['into'] = str_replace( 'span.wpcf7-form-control-wrap', '.form-group', $field['into'] );
}
// Done
return $response;
}
add_filter( 'wpcf7_ajax_json_echo', 'filter_cf7RestResponse', 10, 2 );
// END CF7BS validation messages hotfix
It alters the wrapper class in the REST response to the class used by this plugin (.form-group
).