Pre-populate webform default values with hook_form_alter I have a webform (version 4.11 on Drupal 7) that is failing QA test because the javascript validation is not correctly attaching to an empty required form element-- the 'Please fill out this value' tag is going to the top of the screen instead of near the element that failed validation.

So as a work-around, I decided to add a hook_form_alter and a new validation callback, to manually perform the validation. I am setting the error messages with drupal_set_message. 

It turns out that the $form and $form_state arrays for webforms are apparently different from the typical form. Instead of $form_state['values']['field_key'], I found them here: $form_state['input']['submitted']['field_key'].

However, I can not figure out where each field's #default_value key resides in the $form array. I would expect it to be $form['field_key'], but it's not there. 

How can I pre-populate the default value of form elements in a webform with hook_form_alter?
I found the values here

$form['#node']-&gt;webform['components']


So for the first component, I would change the value like so 

$form['#node']-&gt;webform['components'][1]['value'] = 'test';