I need to alter the default value of a webform in d6, so in my template.php I insert the following function, but it does not work; I don't like to use $get in webform.

function themename_form_alter(&$form, &$form_state, $form_id) {
  if ('webform_client_form_id' == $form_id) {
    $form['id_of_input']['#default_value'] = $node->field_cck_value[0]['value'];
    return $form;

Can you help me?


Webform is a node module. So editing a node even though it contains form can be altered using hook_nodeapi.


You should use

$form['submitted']['id_of_input']['#default_value'] = $node->field_cck_value[0]['value'];

For further details, refer http://drupal.org/node/1558246

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.