gpnf_should_open_modal

  1. Description
  2. Usage
  3. Parameters
  4. Since
  5. Examples
    1. Do not open a modal if a given field is empty.

Description

Filter whether the nested form modal should open or not.

Note: this snippet should be used on the parent form which contains the nested form you want this to apply to.

Usage

window.gform.addFilter( 'gpnf_should_open_modal', 'my_custom_function' );

Parameters

  • shouldOpen bool

    Whether or not the modal should open.

  • modal object

    The Tingle.JS modal object.

  • formId int

    ID of the form this filter is being fired for.

  • fieldId object

    ID of the field this filter is being fired for.

Since

This filter is available since Gravity Forms Nested Forms 1.1.11.

Examples

Do not open a modal if a given field is empty.

window.gform.addFilter( 'gpnf_should_open_modal', function( shouldOpen, modal, formId, fieldId ) {
	if ( $('your-input-field-selector').val() === '') {
		alert('Please fill in that one important field!');
		return false;
	}

	return true;
} );