[wordpress插件] A Forms表格

wordpress 插件 文章 2020-01-22 22:40 589 0 全屏看文

AI助手支持GPT4.0

评分

80

80

描述

A wordpress plugin that allows you to add a form on your website.

一个wordpress插件,可让您在网站上添加表单。

It’s quite easy to configure, some what like C Forms II, but you have the ability to get regular updates and its available on the WordPress Plugin site.

配置非常容易,有些类似于C Forms II,但是您可以定期获取更新,并且可以在WordPress插件站点上获得它。

Since version 2.0.2, you can now create advanced validation rules.

从2.0.2版开始,您现在可以创建高级验证规则。

There are unlimited amount of validation rules that you could have in a form which makes it difficult to manage using a UI.

验证规则的形式是无限的,这使得使用UI进行管理变得困难。

In A Forms you can now create a Global variable called $GLOBALS[“aforms_additional_validations_for_4”] (where 4 is the id of the form) in your themes function file and set a validation array to it.

现在,您可以在A表单中的主题函数文件中创建一个名为$ GLOBALS [“ aforms_additional_validations_for_4”]的全局变量(其中4是表单的ID),并为其设置一个验证数组。

For example lets say you have an email field, a contact field and a preferred method of contact field.

例如,假设您有一个电子邮件字段,一个联系人字段和一种首选的联系人方法。

The preferred method of contact field is a checkbox field with the values Email and Phone.

首选的联系方式字段是一个复选框字段,其值为电子邮件和电话。

You want to make sure your visitor fills in Phone if Phone is selected by the preferred method of contact.

如果通过首选联系方式选择了“电话”,则要确保访客填写“电话”。

All you need to do is assign an array like $GLOBALS[“aforms_additional_validations_for_4”][“a_form_contact_us_phone”] = “required” to $GLOBALS[“aforms_additional_validations_for_4”] (remember to replace the 4 with your forms id) if the phone field is

您需要做的就是将一个像$ GLOBALS [“ aforms_additional_validations_for_4”] [“ a_form_contact_us_phone”] =“ required”的数组分配给$ GLOBALS [“ aforms_additional_validations_for_4”](请记住将4替换为您的表单ID)

empty while the preferred method of contact is Phone.

空,而首选的联系方式是电话。

Here is some sample code:

以下是一些示例代码:

add_action( ‘init’, ‘register_a_forms_additional_validations’ );

add_action('init','register_a_forms_additional_validations');

function register_a_forms_additional_validations() {
    

函数register_a_forms_additional_validations(){
    

$GLOBALS[“aforms_additional_validations_for_4”] = array();
    

$ GLOBALS [“ aforms_additional_validations_for_4”] = array();
    

if (isset($_POST[“a_form_contact_us_preferred_method_of_contact_1”]) && isset($_POST[“a_form_contact_us_phone”]) && $_POST[“a_form_contact_us_preferred_method_of_contact_1”] == “Phone” && $_POST[“a_form_contact_us_phone”] == “”) {

if(isset($ _ POST [“ a_form_contact_us_preferred_method_of_contact_1”])&& isset($ _ POST [“ a_form_contact_us_phone“])&& $ _POST [“ a_form_contact_us_preferred_method_of_contact_1”] ==“ Phone” && $ _POST =“ _ a_]


        


        

$GLOBALS[“aforms_additional_validations_for_4”][“a_form_contact_us_phone”] = “required”;
    

$ GLOBALS [“ aforms_additional_validations_for_4”] [“ a_form_contact_us_phone”] =“必填”;
    

}
    

}
    

if (isset($_POST[“a_form_contact_us_preferred_method_of_contact_0”]) && isset($_POST[“a_form_contact_us_email”]) && $_POST[“a_form_contact_us_preferred_method_of_contact_0”] == “EMail” && $_POST[“a_form_contact_us_email”] == “”) {

if(isset($ _ POST [“ a_form_contact_us_preferred_method_of_contact_0”])&& isset($ _ POST [“ a_form_contact_us_email“])&& $ _POST [“ a_form_contact_us_preferred_method_of_contact_0”] ==“ EMail” _____ [=


        


        

$GLOBALS[“aforms_additional_validations_for_4”][“a_form_contact_us_email”] = “required”;
    

$ GLOBALS [“ aforms_additional_validations_for_4”] [“ a_form_contact_us_email”] =“必填”;
    

}

}

}

}

安装步骤

1) Install WordPress 4.4.1 or higher

1)安装WordPress 4.4.1或更高版本

2) Download the latest from:

2)从以下位置下载最新版本:

https://wordpress.org/extend/plugins/jquery-ui-theme

https://wordpress.org/extend/plugins/jquery-ui-theme

https://wordpress.org/extend/plugins/a-forms

https://wordpress.org/extend/plugins/a-forms

3) Login to WordPress admin, click on Plugins / Add New / Upload, then upload the zip file you just downloaded.

3)登录WordPress管理员,单击“插件” /“添加新文件” /“上传”,然后上传您刚刚下载的zip文件。

4) Activate the plugin.

4)激活插件。

下载地址

https://downloads.wordpress.org/plugin/a-forms.2.5.1.zip

https://downloads.wordpress.org/plugin/a-forms.2.5.1.zip

-EOF-

AI助手支持GPT4.0