Last updated 21 February 2017. Created on 10 June 2010.
Edited by DrupalWoody, Kifah Meeran, jrockowitz, davidhofmann. Log in to edit this page.


Fields can be called as [submission:values:FIELD_KEY]

If your field in a field set you can use


You can find the Field Key and the Field Set Field Key by selecting Edit for the appropriate items on the Form components tab.

Webform 3.x

In newer versions of Webform (3.9 and higher), the e-mail Subject field is tokens-enabled even though it does not include a list of tokens below the field. The tokens for %value[key] are the most useful tokens for generating dynamic subject lines.

Webform 2.x and older 3.x versions

To create a custom email subject using user submitted values you may do it in the following way:

  1. Add a new form component of the type "hidden". Let's call it "Email subject".
  2. Using the desired email subject in the original post for this issue as an example, in the default value field for this component enter:
    Event enquiry from %cid[x] for %cid[y] in %cid[z]

    The x, y, and z keys above should represent the component id numbers (cid) relating to the form's component fields for "name", "eventdate", and "city" (Hint: you can find the cid for a form component by mousing over its Edit link in the table on the "Form components" page and noting the last argument in the link's url). It seems that %cid is set up in the module as a token for the array of the form's submitted values.

  3. Choose "Email subject" in the Component drop-down for the E-mail subject setting on the webform's Configuration page.

Naturally, this same technique will work for the "Email from name" and "Email from address" settings as well.

Looking for support? Visit the forums, or join #drupal-support in IRC.


dx17’s picture

Great article, it helps me a lot. But does anyone know what to do in case of multidimensional arrays.

i.e. I want to add the values of my date field into the subject:
"%cid[1] plans a trip on %cid[2]"
results in
"DX17 plans a trip on Array"

Neither this example "%cid[1] plans a trip on %cid[2][day]" nor this one "%cid[1] plans a trip on %cid[2][0]" works.

Thanks for help.

amwranes’s picture

When using %cid[x] in to create a custom e-mail subject, the e-mail goes out with %cid[x] in it instead of the value. I am using Mollom for spam control, but disabling Mollom for the form doesn't fix the issue, so it doesn't appear to be that.

Edit: %value[field name] is now used...

Andrey Zakharov’s picture

Thanks, amwranes! U save my day

doublejosh’s picture

Looks like Webform 6.x-2.9 is %cid[component #]

wheelercreek’s picture

You don't need to make a new component. Just click to "custom subject" when you are entering the emails where the form should send to. I found that you can enter token variables in the subject line (and presumably any of these fields), not just the email template box.

For example I selected a custom subject line and entered: registration %email[name] And the name field from the webform came through in the subject.

brkelner’s picture

Thank you for the information.
I now can have both the First Name and Last Name in the subject line of the submitted webform

gthing’s picture

Do you have to do something special if the fields you're calling are inside a fieldset? I can't get it to work with that configuration.

nicholas.alipaz’s picture

depends on your version I believe. In my experience I had to specify the name of the fieldset, but I am not sure on your situation.

Los Angeles Web Design and development for Drupal.

aubjr_drupal’s picture

Saved me some time for sure - Thanks!

AMoutiers’s picture

Does someone has the solution for drupal 7 ? None of the above works for me

Anonymous’s picture

Hi Ptitoine,

I'm using Drupal 7 with Webforms 3.9:

1. Go to your Form Components
2. Edit the field you want to show up on your subject
3. Get the Field Key, in my case it was: full_name

Now go back to your email, and in your custom subject use:

Text you want customized and add this: %value[Field Key]

In my case:
Customized text %value[full_name]

Please let me know if it works?

jamwilli’s picture

I can only get the first field to appear. The subject line ends up with "US for %value[candidate]. Any idea why the second field will not populate?

VonZesen’s picture

Maybe you have nested your field "candidate" in a fieldset? In this case you have to write "US for %value[field_key_of_your_fieldset][candidate]".

nicholsj’s picture

This has changed.

You now need to use [submission:values:[field key]:nolabel]

(the :nolabel bit is optional - and hides the field label)

"This is an email about [submission:values:subject:nolabel] " where the relevant field key is "subject"

davidhofmann’s picture

For custom subject, if your using a field set, you can use the following:



Field Set named: student
Field in Set: name


perisdr’s picture

The module should add a description under the subject to clarify that you can use the same tokens there as in the mail body.

mepperly’s picture

I need my fields to remain separate--FirstName and LastName, but I want them to both show up in the subject line.

I've tried both

[submission:values:[FirstName] [LastName]:nolabel]

[submission:values:[FirstName]:nolabel] [submission:values:[LastName]:nolabel]

And neither works.

Any suggestions?

DrupalWoody’s picture

Try giving the "Form Key" for the First Name and Last Name fields instead. I don't think you need the brackets, just the field's form key name. When you're editing components, the "Form Key" is the name in the second column of the table.

mepperly’s picture

Here's what ended up working:
Invited Guest Request: [submission:values:FirstName] [submission:values:LastName]

Where "FirstName" and "LastName" are the keys (I had changed them from lowercase and underscore to match a different database).


dvasquez’s picture

Muchas gracias! Espectacular.

praveen_91’s picture

Hi, All
i'm using Drupal 7.56 and webform 7.x-4.15.
Use this [data:your_name-value] "your_name" is field_key.
It's work for me

avinash.thombre’s picture

[submission:values:FIELDSET_FORM_KEY:FIELD_KEY] is working for me. Don't include any wrapper_key or markup_key (like [submission:values:fieldset_key:field_name])if present in the nested structure. Or you can try permutation and combination of [submission:values:fieldset_key:markup_key:wrapper_key:field_name:withlabel], it will definitely work.
Best of luck!

ProperCroc’s picture

For 8.x-5.x

Follow the documentation at Browse available tokens. in the webform_submission section:

Webform tokens from submitted data. Replace the '?' with the 'element_key', 'element_key:format' or 'element_key:format:items'. The 'format' can be 'value', 'raw', or custom format specifically associated with the element The 'items' can be 'comma', 'semicolon', 'and', 'ol', 'ul', or custom delimiter For example, to display the Contact webform's 'Subject' element's value you would use the [webform_submission:values:subject] token.

Short example: [webform_submission:values:name]
Worked for me.