Skip to content

Commit 5826853

Browse files
committed
Create gpnf-relaunch-modal-on-add.js
1 parent 9cfe904 commit 5826853

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Gravity Perks // Nested Forms // Relaunch Modal After Adding Child Entry
3+
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
4+
*
5+
* Instructions:
6+
*
7+
* 1. Install this snippet with our free Custom JavaScript plugin.
8+
* https://gravitywiz.com/gravity-forms-custom-javascript/
9+
* 2. This will automatically apply to all Nested Form fields for the parent form
10+
* on which it is installed.
11+
*/
12+
var $addEntry;
13+
14+
$( '#gform_GFFORMID' ).find( '.gpnf-add-entry' ).on( 'click', function() {
15+
$addEntry = $( this );
16+
} );
17+
18+
$( '#gform_GFFORMID' ).on( 'click', '.gpnf-row-actions .edit-button', function() {
19+
$addEntry = null;
20+
} );
21+
22+
$( document ).on( 'gform_confirmation_loaded', function( event, formId ) {
23+
if ( $addEntry && formId == $addEntry.data( 'nestedformid' ) ) {
24+
$addEntry.click();
25+
}
26+
} );

0 commit comments

Comments
 (0)