wordpress - 需要联系表格 7 下拉力吗?
问题描述
我正在使用 Contact Form 7 为客户制作表格。我已将所有字段设为必填,包括选择(下拉)字段。但是,当未选择下拉字段时,仍会发送表单。
有没有办法“强制”一个字段是必需的?有没有人遇到过这个?你知道如何提供帮助吗?
这是我的代码:
<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|christie@oonie.co.za"
"Pretoria|christie@oonie.co.za"
"Cape Town|christie@oonie.co.za"
"Durban|christie@oonie.co.za"
"Garden Route|christie@oonie.co.za"
"Port Elizabeth|christie@oonie.co.za"
"East London|christie@oonie.co.za"
"Nelspruit|mchristie@oonie.co.za"
"Vaal Triange|christie@oonie.co.za"]</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"]
先感谢您!
解决方案
看起来表单正在发送,因为确实总是填写选择字段。您忘记了“include_blank”属性:
[select* menu-834 include_blank "product 1" "product 2" "product 3"]
它在下拉菜单的选项顶部插入一个空白项,评估为未填写。
请参阅文档以获取include_blank
下拉菜单中的选项:
https ://contactform7.com/checkboxes-radio-buttons-and-menus/#select
推荐阅读
- r - 按组对前一行的值求和
- ruby-on-rails - 如何在 ruby on rails 中的请求之间保持对象处于活动状态
- c# - 从 DataSet 中删除一行不会影响数据库
- android - 用户在表中没有看到正确的值
- laravel - Laravel - 在不同的数据库实例上急切加载过滤相关模型
- javascript - 用于选择下一个数组元素的循环
- c# - 单击列表框项目并在标签中显示文本文件文本
- azure - Azure VMSS Linux 操作系统升级
- java - 命令通过命令行工作,但在使用 ProcessBuilder 时不行
- haskell - 修复的固定点 :: Eq a => (a -> a) -> a -> a