File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments