I'm trying to set the selected value of a webform select form element before it is rendered. I'm using the below code and the textfields are working just fine but no luck with the select options.
function mytheme_preprocess_webform_form(&$vars) {
$vars['form']['submitted']['emailAddress']['#value'] = 'some@email.com'; //This is working
$vars['form']['submitted']['country']['#selected'] = 'BARBADOS'; // This is not working even though #default value is used instead
}
I can't figure it out why this is not working for select field. I would be glad if someone could help me.
Thanks in advance.