gform_is_hidden

Description


The gform_is_hidden filter allows developers to customize whether a field is hidden by conditional logic. This is useful in Conversational Forms, where all fields but the current one are hidden.

Usage

gform.addFilter( 'gform_is_hidden', function( isHidden, field ) {
    // Custom logic here
    return isHidden;
}, 10, 2 );

Parameters

Examples

Customize the visibility by marking a field as hidden only if it is wrapped in a .gfield element, excluding those with the class .gfield_hidden_product, and has the data-conditional-logic attribute set to ‘hidden’.

gform.addFilter( 'gform_is_hidden', function( isHidden, field ) { 
	return field.parents('.gfield').not(".gfield_hidden_product").attr("data-conditional-logic") === 'hidden';
}, 10, 2 );

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 filter is located in gravityforms.js.

Since

The filter was added in Gravity Forms 2.8.10