I have a webform that appears in a block on content type 'job'. I am trying to get two fields from the node into the webform submission. I have this custom module:
function webform_nodevalues_form_alter(&$form, $form_state, $form_id) {
// 1. Webform ID
if ($form_id == 'webform_client_form_237') {
if ($node = menu_get_object()) {
// 2. Webform field for the node title
$form['submitted']['title']['#value'] = $node->title;
// 3. Webform field for a CCK field
$form['submitted']['email']['#value'] = $node->field_email[0]['value'];
} }
}
However, I'm getting this error:
Notice: Undefined offset: 0 in webform_nodevalues_form_alter() (line 35 of /drup/sites/all/modules/webform_nodevalues/webform_nodevalues.module).
Any thoughts on how to get the email field in the webform submission?