Skip to content

Commit 68f6691

Browse files
authored
gpnf-delete-child-entries-when-parent-value-changes.js: Added new snippet.
1 parent 836af8d commit 68f6691

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Gravity Perks // Nested Forms // Delete Child Entries When Parent Value Changes
3+
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
4+
*
5+
* Overview Video:
6+
* https://www.loom.com/share/304641c3136049d0a8d1cf58c7041df5
7+
*
8+
* Instructions:
9+
*
10+
* 1. Install this snippet with our free Custom JavaScript plugin.
11+
* https://gravitywiz.com/gravity-forms-custom-javascript/
12+
*
13+
* 2. Configure the snippet for your form/fields based on the inline instructions.
14+
*/
15+
// Update "4" to the ID of the field on the parent that when changed should delete the child entries.
16+
$( '#input_GFFORMID_4' ).on( 'change', function() {
17+
// Update "5" to the ID of the Nested Form field on the parent form.
18+
window.GPNestedForms_GFFORMID_5.viewModel.entries().forEach( function( item ) {
19+
var $deleteButton = $( 'tr[data-entryid=' + item.id + ']' ).find( '.delete-button' );
20+
GPNestedForms.deleteEntry( item, $deleteButton );
21+
} );
22+
} );

0 commit comments

Comments
 (0)