Related Field Autocomplete Autopopulate issue

I have a related field that I want to populate values in another field depending on what was selected in the related field. Using code below it works if the user selects the popup and selects a value that way. However, if a user starts typing in the related field and selects an option from the autocomplete list, the field is not populating.

Can someone tell me what I am missing?

1 => 
          array (
            'name' => 'yarn_color_a_c',
            'studio' => 'visible',
            'label' => 'LBL_YARN_COLOR_A',
            'displayParams' =>
            array (
              'field_to_name_array' =>
              array (
                'name' => 'yarn_color_a_c',
                'id' => 'tmayc_yarnsystemcolors_id_c',
                'ysc_cost' => 'yarn_flat_cost_a_c',
              ),
            ),
          ),

It’s working now. I realized I was missing the vardefs code.