Support

Account

Home Forums Add-ons Repeater Field Load Select Post Subfields on Repeater Reply To: Load Select Post Subfields on Repeater

  • This example is for a select field that changes the selections in s second select field, but does not deal with the repeater https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-select-example.

    In order to work with repeaters it is important to do the other setps

    
    valueSelect = $(this).val();
    var current_row = $(this).closest('.acf-row');
    var field_to_change = current_row.find('[data-key="key of other field"] .acf-input FIELD TYPE');
    

    I’m not really sure about the $(this) part. As you can see in the example I gave you, I generally work with the value passed to the function in “e” the event. $(e.target) gives me element that triggered the event.

    
    $(document).on('change', '{SELECTOR}, function(e) {
      var target = $(e.target);
      var row = target.closest('.acf-row');
      var field_to_change = row.find(['data-key="{FILED KEY}"] .acf-input {FIELD TYPE}');