Hi,

%get[key] doesn't work for hidden fields but works for textfields.

thanks,
introfini

Comments

introfini’s picture

better yet, it just works for %get[q], not for other variables in the $_GET array like in this example:

node/30110?nid=1000 -> %get[nid]

introfini

quicksketch’s picture

quicksketch’s picture

Status: Active » Closed (duplicate)
ellen.davis’s picture

I did some digging into the code, and have found a possible fix. In function _webform_render_hidden change '#value' to '#default_value'.

gemini’s picture

I assume this was an advice to edit the function in the module file. That didn't help.
I rendered my hidden filed arrays and pin pointed the actual variables that carry posted values. Then I went to my webform template file and before the drupal_render() function entered the following condition:

if(!empty($form['submitted']['field_name']['#post']['submitted']['field_name'])){
  $form['submitted']['field_name']['#value'] = $form['submitted']['field_name']['#post']['submitted']['field_name'];
}

This worked for a regular text field, but didn't work for the hidden email field. The values are being entered into the array just fine. Actually for the email I have [value] set and the ['#default_value'] set (just in case) and after than didn't work out, I went after the :

if(!empty($form['submitted']['emailto']['#post']['submitted']['emailto'])){
  $form['submitted']['emailto']['#validate']['_webform_validate_email'][0]['value'] = $form['submitted']['emailto']['#post']['submitted']['emailto'];
}

which didn't deliver the desired result either. But as I said, it works with regular text fields.

If someone can help me out to get this temporary workaround for the hidden email field working, I would greatly appreciate it.