Starting with version 4.9, Contact Form 7 (CF7) has made it mandatory to have an option checked for radio buttons. If a radio button is not selected, a validation error will appear. In other words, it is now required to have a radio button pre-selected.
The author of CF7, Takayuki Miyoshi, believes a radio button is a required field by default. And he’s not the only one. This follows W3C’s HTML specifications for radio buttons.
Avoid validation errors by setting radio buttons with a default value.
Radio Button Default Values
If you add a radio button to your form using the CF7 tag generator, by default, it will mark an option for you.
Defining your own default values
Your existing Contact Form 7 forms may use CF7 radio buttons that are not set with a default value. Because of this, you may see a validation error appear. To fix this, set a default value on each of your form’s radio buttons:
Choose a package: [radio cf7s-radio1 default:1 "Free" "Premium" "Plus"]
Check your existing forms now to ensure that the radio buttons have a default value.
Using checkboxes instead of radio buttons
Depending on your form, it might not make sense to have a required option. If this is the case, you can use the checkbox tag instead of a radio button. A checkbox does not have a required default value.
For example, below is an example of a radio button field:
Choose an add-on: [radio radio-001 default:1 "Logic" "Multi" "Plus"]
Now, it has become a checkbox field:
Choose an ad-on: [checkbox checkbox-001 "Logic" "Multi" "Plus"]
If you aren’t sure whether to use a checkbox or a radio button, check out the different cases and options in Better Checkboxes & Radio Buttons. For help with detailed semantics and tags, check out Contact Form 7’s Checkboxes, Radio Buttons, & Menus help article.
The following form has a radio button field with a default value and a checkbox field that is not required.
Want to save time & understand your radio buttons better? CF7 Skins has a drag & drop visual editor that does all the hard work for you… and it’s free! Take a look at how the visual editor can help you.