gform_validation_error_form_editor

gform_validation_error_form_editor

DescriptionUsageParametersExamplePlacementSource Code

Description
The 「gform_validation_error_form_editor」 is a Javascript filter that allows the form editor validation error to be overridden.
Usage
12345gform.addFilter( 'gform_validation_error_form_editor', function( error, form, has_product, has_option ) {    // do stuff     return error;} );

Parameters

error string
The error message.

form Form Object
The Form Object.

has_product boolean
Indicates if the current form has a product field.

has_option boolean
Indicates if the current form has a option field.

Example
This example prevents the form from being saved if there is a product field present.
This example uses the gform_admin_pre_render filter to load the hook on the form editor page:
1234567891011121314add_filter( 'gform_admin_pre_render', function ( $form ) {    echo GFCommon::is_form_editor() ? "        " : '';     //return the form object from the php hook    return $form;} );
Placement
This code should be placed in the functions.php file of your active theme within the gform_admin_pre_render hook.
Source Code
This filter is located in js.php.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注