Support

Account

Home Forums Feature Requests Repeater Field Copier Reply To: Repeater Field Copier

  • Hi @codydoodle

    I believe you can do it by using custom Javascript. Here’s an example how to do it:

    function my_acf_repeater_clone() {
    	
    ?>
    <script type="text/javascript">
    (function($) {
    	
        acf.add_action('append', function( el ){
    
            // $el will be equivalent to the new element being appended $('tr.row')
            
            
            // Cache the previous row first
            var prevField = el.prev();
            
            // Get the value for certain field
            var prevFieldValue = prevField.find(".acf-field-1234567890abc input").val();
            
            // Set it to the new row
            el.find(".acf-field-1234567890abc input").val(prevFieldValue);
            
    
        });
    	
    })(jQuery);	
    </script>
    <?php
    		
    }
    
    add_action('acf/input/admin_footer', 'my_acf_repeater_clone');

    Please keep in mind that you need to target the class based on the field key.

    I hope this helps 🙂