How do I change the value of a Hidden element? 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 hook_yamlform_element_info_alter(array &amp;$elements) and I do $elements['hidden_element_name']['#value'] = 'New value of the hidden element' but it doesn't work.

Do you have any idea?
Based on @mradcliffe suggestion, I've implemented hook_form_FORM_ID_alter() and I do:

$form['elements']['hidden_element_name']['#value'] = 'New value of the hidden element';


It works for me! I hope it helps someone!