A few days ago I asked a question about Drupal 8 YAML Form Module: Populate Select Element. I found a solution that it works fine for me.
But now I've got a new doubt. I would like to change the value of a Hidden element and depending of this value, to show some elements in the form or not. I'm trying to implement the hook
$elements['hidden_element_name']['#value'] = 'New value of the hidden element'
Here is the solution: How do I change the value of a Hidden element?
Basically, I've implemented
hook_form_FORM_ID_alter() and I do:
$form['elements']['hidden_element_name']['#value'] = 'New value of the hidden element';
I hope it helps someone!