Drupal Questions & Answers

Ask and answer Drupal related questions! No question too simple or complex!
adrianmak's picture
Asked by on Sat 30th Mar 2013
how to set a webform field value in my custom module?

My webform has a hidden field used to store an unique id. This id is generated from custom logic.

my code is to set this field value. ‘webform_client_form_1’ is my webform id

function webform_custom_form_webform_client_form_1_alter($form, $form_state, $form_id) {

$form[‘submitted’][‘test_id’][’#value’] = ‘COURSE_ID-123456’;

}

When the form is submitted and view the submission result, this hidden field value is empty.

Is there need some more work to do?

Commenting on this Drupal Question is closed.