• Home
  • Pricing
  • Free Resources
  • About
  • Docs
  • Support
  • Account

Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Pricing
  • Blog
    • Free Resources
    • About
  • Support
    • Docs
    • Support
    • Account

gpnf_init_nested_form

  1. Description
  2. Usage
  3. Parameters
  4. Since
  5. Examples
    1. Populate the Parent Form ID

Description

Do something immediately before the nested form modal is initialized.

Usage

gform.addAction( 'gpnf_init_nested_form', 'myCustomFunction' );

Parameters

  • nestedFormId int

    The ID of the nested form being initialized in the modal.

  • gpnf \GPNestedForms

    The instance of GPNestedForms (specific to the parent form and Nested Form field) that is initializing the modal.

Since

This action is available since Gravity Forms Nested Forms 1.0-beta-8.25.

Examples

Populate the Parent Form ID

This example demonstrates how to populate the ID of the parent form that is loading the child form into a field on the child form. This is useful if you want to apply conditional to your child form based on the parent form from which the child form is being loaded.

/**
 * Gravity Perks // Nested Forms // Populate Parent Form ID in Child Form
 * https://gravitywiz.com/documentation/gravity-forms-nested-forms/
 *
 * This is useful if you want to apply conditional to your child form based on the parent form from which the child form is being loaded.
 * 
 * Instructions:
 *     1. Install our free Custom Javascript for Gravity Forms plugin.
 *        Download the plugin here: https://gravitywiz.com/gravity-forms-custom-javascript/
 *     2. Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin.
 */
gform.addAction( 'gpnf_init_nested_form', function( childFormId, gpnf ) {
	
	// Update "123" to your the ID of your child form.
	var targetChildFormId  = 123; 
	
	// Update "4" to the ID of the child field in which the parent form ID will be populated.
	var targetChildFieldId = 4;
	
	if ( childFormId == targetChildFormId ) {
		// Delaying setting value so Populate Anything can pick up the change event. 
		// Internal: HS#32287.
		setTimeout( function() {
			$( '#input_' + targetChildFormId + '_' + targetChildFieldId ).val( gpnf.formId ).change();
		} );
	}
} );

All Perks

  • GF Address Autocomplete
  • GF Advanced Calculations
  • GF Advanced Phone Field
  • GF Advanced Save & Continue
  • GF Auto List Field
  • GF Auto Login
  • GF Better User Activation
  • GF Blocklist
  • GF Conditional Logic Dates
  • GF Conditional Pricing
  • GF Copy Cat
  • GF Date Time Calculator
  • GF Disable Entry Creation
  • GF Easy Passthrough
  • GF eCommerce Fields
  • GF Email Users
  • GF Entry Blocks
  • GF Expand Textareas
  • GF File Renamer
  • GF File Upload Pro
  • GF Google Sheets
  • GF Inventory
  • GF Limit Checkboxes
  • GF Limit Choices
  • GF Limit Dates
  • GF Limit Submissions
  • GF Live Preview
  • GF Media Library
  • GF Multi-Page Navigation
  • GF Nested Forms
  • GF Notification Scheduler
  • GF Page Transitions
  • GF Pay Per Word
  • GF PayPal One-time Fee
  • GF Placeholder
  • GF Populate Anything
  • GF Post Content Merge Tags
  • GF Preview Submission
  • GF Price Range
  • GF QR Code
  • GF Randomizer
  • GF Read Only
  • GF Reload Form
  • GF Terms Of Service
  • GF Unique ID
  • GF Word Count

Copyright © 2023 · Powered by WordPress · Gravity Wiz LLC

  • Support
  • Affiliates
  • About
  • Sitemap
  • Terms & Conditions of Use
  • Privacy Policy
  • Cookies Policy