Support

Account

Home Forums Add-ons Repeater Field Dynamically populate repeater field with select field Reply To: Dynamically populate repeater field with select field

  • Well I solved the issue. I modified the priority of my filters, and instead of using the field name, I used the field keys. Code ended up like this:

    I changed the priority on the select field population function to run before the repeater population

    add_filter('acf/load_field/name=item_shipped', 'opo_item_select_options', 9, 1);

    function load_opo_items_to_ship( $value, $field, $post_id ){
         $opo_id = url_to_postid( get_permalink());
    
         $value = array();
         if( have_rows('po_information_purchase_order_items', $opo_id) ) {
              while( have_rows('po_information_purchase_order_items', $opo_id) ) { 
                   the_row();
                   $value[] = array(
                      'field_5c76cc4bace4b' => get_sub_field('opo_item_ordered'),
    	          'field_5c76ccb3ace4c' => get_sub_field('opo_item_description'),
                   );
              }
         }
         return $value;
    }
    add_filter('acf/load_value/key=field_5c76cc36ace4a', 'load_opo_items_to_ship', 10, 3);