Skip to content

Commit bc17c96

Browse files
authored
gpnf-subscribe-to-child-entry-updates.js: Updated to wrap in gfcc_deferred.
1 parent aa62568 commit bc17c96

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

gp-nested-forms/gpnf-subscribe-to-child-entry-updates.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
* If you're having issues getting this to work, try using our [Gravity Forms Custom Javascript](https://gravitywiz.com/gravity-forms-code-chest/)
66
* plugin. It handles ensuring the Nested Forms has fully initialized so you don't have to.
77
*/
8-
// Get your Nested Forms JavaScript instance where "123" is the form ID and "4" is the Nested Form field ID.
9-
var gpnf = window.GPNestedForms_123_4;
8+
gform.addAction( 'gfcc_deferred', function() {
9+
10+
// Get your Nested Forms JavaScript instance where "123" is the form ID and "4" is the Nested Form field ID.
11+
var gpnf = window.GPNestedForms_123_4;
12+
13+
gpnf.viewModel.entries.subscribe( function( entries ) {
14+
// Do whatever you want any time the child entries for your Nested Form field are updated.
15+
console.log( entries );
16+
} );
1017

11-
gpnf.viewModel.entries.subscribe( function( entries ) {
12-
// Do whatever you want any time the child entries for your Nested Form field are updated.
13-
console.log( entries );
1418
} );

0 commit comments

Comments
 (0)