I noticed a lot of people are trying to do something with the values entered into webform, after it is submitted.

What I am trying to do is send values to webform, from a node. Any one have any ideas/solutions?

i have an inventory, with nodes created with CCK, and am using webform to allow people to request items in the inventory, while being able to track who it is is requesting what items.

For example if someone wanted a particular book, they could search for that particular book node, click on a link and there would be a request webform. But I want to pre populate some of the webform fields, with information from that particular node. Hope that makes sense

thanks for any help anyone might be able to provide

#16 form.jpg47.48 KBali1987
#16 form1.jpg15.5 KBali1987
Members fund testing for the Drupal project. Drupal Association Learn more


josoal’s picture


prunelle’s picture

I would need such help too.

quicksketch’s picture

You can pass default values to a webform by setting a query string on the webform page URL. Like this:

<a href="node/10?email=nate@example.com&name=Nate">Fill out form</a>

Then in your webform configuration, set the default value for the fields that will receive these values as such:


There are reports of %get not working correctly in multi-page forms however, so watch out for that bug.

metastate’s picture

I have been trying to do the same thing. Thanks for the info quicksketch!

For my situation I needed the default values to be based on each individual node listed on a page. One of the values was the node title, so for my link to the form I put:

<a href="/node/10?title=<?php print $title; ?>">Fill out form</a>

But I would also like to pass the node's taxonomy term to the URL for the form to get. Any idea if this is this possible?

quicksketch’s picture

Eh, taxonomy is one of the worst data structures in all of Drupal. You can pull it out be it's a pain. After doing a print_r() on a $node object, you can see the taxonomy structure. It'll end up being something like this:

$tids = array_keys($node->taxonomy);
$tid = array_shift($tids);

<a href="/node/10?title=<?php print $title; ?>&term=<?php print $tid ?>">Fill out form</a>

You could shorten it down with:

<a href="/node/10?title=<?php print $title; ?>&term=<?php print array_shift(array_keys($node->taxonomy)); ?>">Fill out form</a>

And that'll get you the first term for that node. If you use multiple terms or vocabs though, you'll need to loop through all the terms to find the right vocabulary you want.

quicksketch’s picture

Status: Active » Closed (fixed)
metastate’s picture

This was a few months ago, but to provide an update on what I ended up doing as a workaround to get the taxonomy term and pass it to a webform field as the default value...

Since I use Pathauto to create URL aliases, I set this particular content type to have URLs in the format /taxonomy-term/node-title/node-id. By then passing the URL to the webform, the taxonomy term I needed would be available to me.

Because I wanted a link to the webform on every page for this content type I added this link to my node-contenttype.tpl.php file:

<a href="/my-webform?field1=<?php print $title; ?>&field2=<?php print $node_url; ?>">Go to my webform</a>

(Change my-webform, field1 and field2 to suit your purposes.)

This then passes the node title and URL to the webform. I get it by using the default values of %get[field1]
and %get[field2] in two seperate fields. (As a side note, field2 - the URL - is hidden to the user as it's for admin purposes only - very handy.)

Hope that might help someone down the line!

mry4n’s picture

Damn, I've been trying to find the info in your post for hours! So weird that something so basic would be buried so deep. Thanks!

stoic’s picture

Any idea on how to do this WITHOUT using %get[value]?

I'm using %get to pull one value from the URL. Then, with that, I need to set the default values of SEVERAL other fields (too many to pass in the URL). I use the value from the URL in series of if statements which then determines the default values of the other fields.

Any ideas?

It seems simple but I can't sort it out.

Thanks -

designcrs’s picture

@stoic (#9):
You could create a form with lots of hidden fields. Then just let that form post to your webform's address and use %post[] variables there.

I hope this helps...

Useful Idiot’s picture

4 years later, are you still around? I could use a little help with this, willing to pay. Let me know.Thanks!

zfreaker’s picture

Using GET method is a bit ugly. I use set_variable to pass data from one form to another internally implementing hook_form_alter. However, webform component structure is one big mess! When setting webform field default values you can use:

$form['submitted']['your_fieldname']['#default_value'] = 'your value';

Hope it helps!

zfreaker’s picture

zfreaker’s picture

IamOnStage’s picture

I too would be very interested in this.

As Webform is available as a block, it would seam logical if the form could pull information form the node it is in!

ali1987’s picture

Title: Send data from field, to Webform as a default value. » populate a field with another one
Version: 5.x-1.2 » 6.x-3.15
Assigned: Unassigned » ali1987
Status: Closed (fixed) » Active
15.5 KB
47.48 KB

Hi guys,

I'm new in drupal. I've made a form for the users send their requests. this form contains some textfields to be filled by the users. after reviewing the request by admin, a reply will be shown under request information history. I've added a fieldset to be shown to the user which is populated by the admins's reply. there is a private textarea to insert the reply by the admin. I want to link the value of textarea to the fieldset. this means whenever admin replys in the textarea, it will be shown to the user in fieldset in his/her submission history. is there anyway to do this?

Thank you in advance

quicksketch’s picture

@ali1987: I think what you're describing is beyond the functionality of Webform, though I'm not sure what you mean by "I want to link the value of textarea to the fieldset."

quicksketch’s picture

Status: Active » Closed (fixed)

Please open a new issue for any further questions on this topic.

Chris McGrath’s picture

Issue summary: View changes

Mainly how do I have a user enter a number or text in a field above and have that same value appear in a second field below?

DanChadwick’s picture

Re #19: You'll need some custom jQuery. Programming support is outside of the scope of the webform issue queue.

yalegria’s picture


Vako’s picture

In the last 8 years that this topic had been opened, surely there has been some improvement in Webform to accommodate such a feature to be built-in. See the following link for a similar request and we can continue the discussion there perhaps: https://www.drupal.org/node/2663026