gform_abort_conditional_logic_do_action

Description

A JavaScript filter that allows add-ons to abort gf_do_action() function.

Usage

gform.addFilter( 'gform_abort_conditional_logic_do_action', function( abort, action, targetId, useAnimation, defaultValues, isInit, formId, callback ) {

        // test things
 		abort = true;
	}
	return abort;
} );

Parameters

  • $doAbort boolean
    The value being filtered. True to abort conditional logic action, false to continue. Defaults to false.
  • $action string
    The conditional logic action that will be performed. Possible values: show or hide
  • $targetId string
    HTML element ID that will be the targed of the conditional logic action.
  • $doAnimation boolean
    True to perform animation while showing/hiding field. False to hide/show field without animation.
  • $defaultValue array
    Array containg default field values.
  • $isInit boolean
    True if form is being initialized (i.e. before user has interacted with any input). False otherwise.
  • $formId integer
    The current form ID.
  • $do_callback function
    Callback function to be executed after conditional logic is executed.

Example

This example will abort the conditional logic gf_do_action() for field ID 5 on form ID 10.

gform.addFilter( 'gform_abort_conditional_logic_do_action', function( abort, action, targetId, useAnimation, defaultValues, isInit, formId, callback ) {

        // Abort conditional logic gf_do_action() for form Id 10, field Id 5.
	if ( formId == 10 && targetId == '#field_10_5' ) {
		abort = true;
	}
	return abort;

} );

Placement

Your code snippet can be placed in an HTML field on your form or in a theme custom JavaScript file.

See also the JavaScript/jQuery section in this article: Where Do I Put This Code?

Source Code

This hook is located in conditional_logic.js.

Since

Gravity Forms version 2.6.2