Starting with version 4.9, Contact Form 7 (CF7) has made it mandatory to have an option checked for radio buttons. It also shows a validation error when no option in a radio buttons group is checked, effectively making all CF7 Radio Buttons required.

This change is because the Contact Form 7 author, Takayuki Miyoshi, believes that radio button is a required field by default. This is backed by the HTML specification for radio buttons.

If you use a CF7 Radio Button without setting a Default value, this may lead to unexpected validation errors.

We recommend that all CF7 Radio Buttons are set with a default value. This ensures that no validation error occurs when users do not select an option.

Default value automatically created

A default value is now added automatically to newly created Radio Button fields built using the CF7 Tag Generator.

Contact Form 7 Radio Button Default Value

Defining your own default values

Your existing Contact Form 7 forms may use CF7 Radio Buttons which are not set with a default value. This may now cause a validation error in your form if users do not select an option.

You can easily set a default value on each CF7 Radio Button:

Choose a package: [radio cf7s-radio1 default:1 "Free" "Premium" "Plus"]

Your existing Contact Form 7 forms may now show unexpected validation errors. We are now recommending that Contact Form 7 users check all CF7 Radio Buttons on existing forms are set with a default value.

Using check-boxes instead of radio buttons

If it does not make sense for you to make your current radio button(s) required or have any default value, you can make use of checkbox(es). Unlike radio buttons, checkboxes do not have a requirement of needing a default value.

Original Radio button

Choose an add-on: [radio radio-001 default:1 "Logic" "Multi" "Plus"]

Changing to checkboxes

Choose an ad-on: [checkbox checkbox-001 "Logic" "Multi" "Plus"]

Example Form

The following form has a radio button with a default value. It also uses checkboxes for options that are not required for the user. Users may use a similar approach in their forms.

Sample Form
  1. YesNo
  2. Arts and CraftsProgrammingPublic Speaking

* Required

Thank you choosing our Example Platform for your business.

Form Code:

Sample Form - Radio Buttons and Checkboxes

Further reading

%d bloggers like this: