Description
This JavaScript hook can be used to filter new Repeater Field groups before they are added.
Usage
gform.addFilter( 'gform_repeater_item_pre_add', function ( clone, item ) { // do stuff return clone; } );
Parameters
- clone Javascript Object
The group of Repeater Field items.
-
item Javascript Object
The group of Repeater Field items before being cloned and the inputs cleared.
Example
This example shows how you can set the value of the second input in a Repeater Field group.
<script> gform.addFilter( 'gform_repeater_item_pre_add', function( clone, item ) { // do stuff clone.find('.gfield_repeater_cell:eq(1) input').val('your new value'); return clone; } ); </script>
Placement
Your code snippet can be placed in a HTML field on your form or in a theme custom JavaScript file.
Source Code
This filter is located in js/gravityforms.js.