Reputation: 33
I am using Contact Form 7 to make a form for a client. I have made all fields required,including the selects (drop down) fields. However, the form is still being sent through when the drop down feilds aren't selected.
Is there any way to 'force' a field to be required? Has anyone come across this before? Do you know how to assist?
Here is my code:
<label> Name: (Required)
[text* your-name] </label>
<label> Surname: (Required)
[text* your-name] </label>
<label> Contact Number: (Required)
[text* your-number] </label>
<label> Email Address: (Required)
[email* your-email] </label>
<label> Choose Branch: (Required)[select* recipient "Choose Branch:"
"Johannesburg|[email protected]"
"Pretoria|[email protected]"
"Cape Town|[email protected]"
"Durban|[email protected]"
"Garden Route|[email protected]"
"Port Elizabeth|[email protected]"
"East London|[email protected]"
"Nelspruit|[email protected]"
"Vaal Triange|[email protected]"]</label>
<label> Product: (Required)[select* product "Please select product:"
"Product"
"Product"
"Product"
"Product"
"Product"
"Product"
"Product"
"Product"]</label>
<label> Physical Address: (Required)
[text* your-area] </label>
<label> Size in Meters: (Required)
[text* your-area] </label>
<label> Enquiry
[textarea your-message class:bigger-textrea] </label>
[submit "Send"]
Thank you in advance!
Upvotes: 3
Views: 11108
Reputation: 2444
It looks like the form is being sent, because the select fields are indeed always filled out. You forgot the "include_blank" attribute:
[select* menu-834 include_blank "product 1" "product 2" "product 3"]
It inserts a blank item into the top of options of the drop-down menu which evaluates as not-filled-out.
See docs for include_blank
option in drop-down menus:
https://contactform7.com/checkboxes-radio-buttons-and-menus/#select
Upvotes: 8