gpnf_init_nested_form
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-code-chest/
* 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 Connections
All Perks
- GF Address Autocomplete
- GF Advanced Calculations
- GF Advanced Phone Field
- GF Advanced Save & Continue
- GF Advanced Select
- GF Auto List Field
- GF Auto Login
- GF Better User Activation
- GF Blocklist
- GF Bookings
- 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 Email Validator
- GF Entry Blocks
- GF Expand Textareas
- GF File Renamer
- GF File Upload Pro
- GF Inventory
- GF Limit Checkboxes
- 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 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 Submit to Access
- GF Terms Of Service
- GF Unique ID
- GF Word Count