How to customize the subject field with form component values

Last updated on
30 April 2025

7.x-4.x

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

If your field in a field set you can use

[submission:values:FIELDSET_FIELD_KEY:FIELD_KEY]

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.
For example: if you have a field named "address" you can reference this field by using %value[address].

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.

Help improve this page

Page status: Not set

You can: