Webform hook field text element
There are more than one way to do what you are  asking note both these will require you to create a custom module. (I assume you know how to do this or can google it)

here need to change to your form id, and your field names.. 

function MYMODULE_form_alter(&amp;$form, FormStateInterface $form_state, $form_id) {
    // change to your form id
  if ($form_id == 'webform_submission_contact_add_form') {
    //dump($form['elements']);
    $form['elements']['select_me']['#ajax'] = [
      'callback' =&gt; 'MYMODULE_callback_ajax',
      'event' =&gt; 'change',
      'wrapper' =&gt; 'changethis',
      'method' =&gt; 'replace',
    ];


   $form['elements']['TEXTFIELDNAME']['#prefix'] = '&lt;div id="changethis"&gt;';
   $form['elements']['TEXTFIELDNAME']['#suffix'] = '&lt;/div&gt;';  
 }
}
// ajax call back 
function MYMODULE_callback_ajax(&amp;$form, FormStateInterface $form_state) {
  $value_selected = $form_state-&gt;getValue('select_me');
  if (!empty($value_selected)) {
    // Here do queries then set the value of your text field.

    $form['elements']'TEXTFIELDNAME']['#value'] = $value_selected;
    return $form['elements']'subject'];
  }
}