描述
Adds native HTML5 validation support to the Gravity Forms plugin.
It supports both standard and paginated forms.
Supported Standard Fields
- Single Line Text
- Paragraph Text
- 下拉菜单
- 多选
- 复选框
- 号码
- 单选框
Supported Advanced Fields
- 商店名字
- 时间
- Time
- 电话号码
- 网址
- 站点
- 用户名字
- 米秒
- 邮箱地址
- 文件上传
Supported Post Fields
- 书名
- Body
- 片段
- 标签
- 目录
- Post Image
- 自定义字段
Supported Pricing Fields
- 商品
- 数量
- 信用卡
Supported Hooks
- gform_name_prefix_required
- gform_name_middle_required
- gform_name_suffix_required
- gform_address_street2_required
These hooks can be used to force html5 validation on these subfields.
Example usage:
The following would apply your function to all forms.
add_filter( ‘gform_name_prefix_required’, ‘your_function_name’, 10, 2 );
To target a specific form append the form id to the hook name. (format: gform_password_FORMID)
add_filter( ‘gform_name_prefix_required_6’, ‘your_function_name’, 10, 2 );
The return value is expected to be a boolean value; As such you can also use them with “__return_true”.
add_filter( ‘gform_address_street2_required’, ‘__return_true’ );
必需条件
This plugin requires prior installation and activation of Gravity Forms plugin by Rocketgenius ver. 1.9 and above.
Tested
Up to Gravity Forms plugin ver. 1.9.17.6
安装
- Download the gravityforms-html5-validation.zip file to your local machine.
- Either use the automatic plugin installer (Plugins – Add New) or Unzip the file and upload the isw-blocks folder to your /wp-content/plugins/ directory.
- Activate the plugin through the Plugins menu
- Visit the Gravity Forms general settings page ( Forms -> Settings ) and make sure that Output HTML5 option is set to yes.
- All fields configured as “required” will now use native html5 validation.
贡献者及开发者
更新日志
2.4.2
- Fix DOM class names and methods.
2.4.1
- Fix script debug flag.
2.4
- Add support for various fields.
- Add support for paginated forms.
2.3
- Initial WordPress.org Release