Hello,

I have the following code:

function autofill_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'webform_client_form_2') {
    $form['submitted']['acc_id'][1]['#value'] = arg(2);
  }
}

and it does what I expect (fills a webform field with the url argument).

But it didn't save the field value in the webform :(

Can anybody help me, what I did wrong?

Thanks!
Czollli

Comments

vasi1186’s picture

Hi,

Can you try this: $form['submitted']['acc_id'][1]['#default_value'] = arg(2);

Vasi.

czollli’s picture

That's it. Thanks a lot!