Description
A JavaScript filter that allows add-ons to define certain clicks within the conditional logic flyout as valid, to prevent the flyout from closing inadvertently when interacting with the add-on’s functionality.
Usage
gform.addFilter( 'gform_conditional_logic_is_valid_flyout_click', function( isValidFlyoutClick, event ) {
if ( whatever you want to define as a valid click === true ) {
isValidFlyoutClick = true;
}
return isValidFlyoutClick;
} );
Parameters
- isValidFlyoutClick boolean
Whether a click event is from a valid flyout element. - event Event Object
The JavaScript Event object.
Example
GravityWiz uses this JavaScript filter to prevent the conditional logic flyout from closing when interacting with the datepicker in their Conditional Logic Dates Perk to prevent the flyout from closing when clicking the month or year selectors:
gform.addFilter( 'gform_conditional_logic_is_valid_flyout_click', function( isValidFlyoutClick, event ) {
if ( isValidFlyoutClick ) {
return isValidFlyoutClick;
}
var $target = $( event.target );
if ( $target.parents( '.gpcld-datepicker' ).length || $target.parents( '.ui-datepicker-calendar' ).length || $target.parents( '.ui-datepicker-header' ).length ) {
isValidFlyoutClick = true;
}
return isValidFlyoutClick;
} );
Placement
Reference the article Adding JavaScript Code to the Admin Side of Your Site.
Source
This filter is located in conditional_flyout.js
Since
This JavaScript filter was added in Gravity Forms 2.7.5.