File tree Expand file tree Collapse file tree 1 file changed +3
-22
lines changed Expand file tree Collapse file tree 1 file changed +3
-22
lines changed Original file line number Diff line number Diff line change 11/**
2- * Gravity Perks // Nested Forms // Subscribe to Child Entry Updates
3- * https://gravitywiz.com/documentation/gravity-forms-nested-forms/
2+ * We're no longer using the experimental folder for experimental snippets. 🚧
3+ * You can now find the snippet here:
4+ * https://github.com/gravitywiz/snippet-library/blob/master/gp-nested-forms/gpnf-add-child-entries-to-the-top.js
45 */
5- // Get your Nested Forms JavaScript instance where "4" is the Nested Form field ID.
6- var gpnf = window . GPNestedForms_GFFORMID_13 ;
7- var entryCount = 0 ;
8- var doingItLive = false ;
9-
10- gpnf . viewModel . entries . subscribe ( function ( entries ) {
11- if ( ! doingItLive ) {
12- entryCount = entries . length ;
13- }
14- } , null , 'beforeChange' ) ;
15-
16- gpnf . viewModel . entries . subscribe ( function ( entries ) {
17- // Check if an entry was added.
18- if ( ! doingItLive && entries . length > entryCount ) {
19- doingItLive = true ;
20- gpnf . viewModel . entries . splice ( 0 , 0 , gpnf . viewModel . entries . pop ( ) ) ;
21- entryCount = entries . length ;
22- doingItLive = false ;
23- }
24- } ) ;
You can’t perform that action at this time.
0 commit comments