Wordpress Contact Form 7 radio not required

Viewed 17286

I have a form with few fields along with a radio button. This radio button is an optional field. But I am not able to submit form if I do not select any option from the radio button.

<div class="input-field-outer">
    [text* your-name class:name placeholder "Name or business name*"]
</div>
<div class="input-field-outer">
    [email* email placeholder "Email*"]
</div>
<div class="input-field-outer">
    [text* contact-number id:telno class:hs-phone-number placeholder "Contact number*"]
    <span id="errmsg"></span>
</div>
<div class="input-field-outer">
    <div class="radio-outer">
        [radio customer_type "New Customer" "Old Customer"]
    </div>
</div>

It will work when I make any of them selected default:

[radio customer_type default:1 "New Customer" "Old Customer"]

Any ideas about using radio button with no items default.

5 Answers

Just read this comment which says:

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.

and

If you need to have no required option you can switch to using a checkbox.

So, building a workaround does not meet the W3C's specifications and and may not be the best solution because of this.

Related