Support

Account

Home Forums Add-ons Repeater Field Repeater field – different default values sets Reply To: Repeater field – different default values sets

  • 
    jQuery(document).ready(function($){
      if (typeof acf == 'undefined') { return; }
      // replace the following field key with your type field
      // an the field type with your field type
      $(document).on('change', '[data-key="field_579376f522130"] .acf-input select', function(e) {
        var field = acf.getField('field_579376f522130');
        var choice = field.val();
        // at this point you need to find the repeater
        // how you would do that is completely dependent on your field structure
        // what is the parent of this field?
        // what is the parent of the repeater?
        // you will need to know this especially if this repeater can appear on the page more than once
        // once you find the repeater you need to add/remove rows
        // and loop through those rows to set the values of the sub fields
      });
    });
    

    When building JS to do this type of thing is is highly specific to your exact needs and the way your fields are created. There really isn’t much that is generic and unfortunately, there aren’t may good examples to be found.