Select list set default value does not work I have referenced filed, which works like select list, I want first value be always default value in content edit page. Now N/A is always selected.

function theme_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

  $form['field_my_name']['und']['#default_value'] = 1;
}


This is my code, but it does not work
To set the default value of field change the default value inside the widget like the following :

 $form['field_my_name']['widget']['#default_value'] = 1;