Same problem here. Although the changelog says it should be fixed, this bug is still present in version 4.9.1. I also downgraded to version 4.8.1 and it’s working again.
I hope the authors will not keep ignoring this thread.
It shouldn’t be hard to add an option to make the radio boxes mandatory or not.
There’s barely support for this plugin. I already switched to Gravity Forms a long time ago, but some of my older sites are still using CF7…
As I had the same issue I looked at the code and it seems as this is easy to fix. It boils down to removing the validation for the “radio” field like this:
remove_filter( 'wpcf7_validate_radio', 'wpcf7_checkbox_validation_filter', 10 );
Be aware that this globally disables validation for “radio”. I don’t see any side-effects right now but be aware what you are doing here.
For anyone wanting to dig deeper, this is the relevant change in 4.9: https://plugins.trac.wordpress.org/browser/contact-form-7/tags/4.9/modules/checkbox.php#L206
Thomas —
Thank you for the code that might solve this problem. Could you tell us specifically where to add the code?
Edit: Never mind — I just dropped it into my “functions” file & (so far) everything works fine — no more validation error.
Thanks!
-
This reply was modified 6 years, 3 months ago by Jim Reading.
Here is another solution if you still require some radio buttons to be required:
Add a required class to your radio fields that still need to be required:
[radio theName class:required "Yes" "No"]
Then add this code to functions.php
remove_filter('wpcf7_validate_radio', 'wpcf7_checkbox_validation_filter', 10);
add_filter('wpcf7_validate_radio', function($result, $tag) {
if (in_array('class:required', $tag->options)) {
$result = wpcf7_checkbox_validation_filter($result, $tag);
}
return $result;
}, 10, 2);