gform_reset_pre_conditional_logic_field_action

gform_reset_pre_conditional_logic_field_action

DescriptionUsageParametersExamples1. Prevent all field values being resetPlacementSource CodeSince

Description
This JavaScript hook can be used to prevent the field value being reset to its default value when hidden by conditional logic on the frontend.
Please note fields which are hidden by conditional logic when the form is submitted will not be saved when the entry is saved.
Usage

Parameters

reset boolean
Determines if the field values should be reset to default when the field is hidden. Default is true.

formId integer
The ID of the current form.

targetId string
The ID selector for the field container (li) in the format #field_{formId}_{fieldId} e.g. #field_10_2

defaultValues string|array
The field default values.

isInit boolean
True when the form is initially displayed, otherwise false.

Examples
1. Prevent all field values being reset
The following example shows how you can prevent the field values being reset to default when the field is hidden by conditional logic.

Placement
Your code snippet can be placed in a HTML field on your form or in a theme custom JavaScript file.
Source Code
This filter is located in js/conditional_logic.js
Since
This filter was added in Gravity Forms 2.0.7.1.

发表回复

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