Webform allows several special values to be used as defaults when configuring a component. The special placeholders are commonly called tokens. The tokens Webform supports include:
Note that Webform does not use the Token module for its replacements, so Webform's tokens may vary from tokens used in other modules. However, you can use the Webform Patched module to use Token module tokens.
Populating a Field with User Data
Webform includes several tokens that contain user data such as
%useremail. In addition, Webform supports any field added through the core profile module. For example, if you had profile fields setup for "First Name" and "Last Name" you could set these values to be the default values for a Webform component.
When setting up the profile fields at Administer->User management->Profiles (admin/user/profile), take care to remember the "Form name" value, as this will be needed when configuring the default value of Webform components that will contain user information.
Setting up a profile field at admin/user/profile/add/textfield. Note the "Form name" value is set to "profile_first_name"
After checking the configuration of a profile field, you can use the profile Form name as the default value in a Webform component.
When configuring a Webform component, use the Profile Form name in the special
If the current user has filled out the First name profile field, their name will automatically be used as the default value when filling out the webform.
Setting Default Values from the URL (7.x-3 and earlier)
%get[key] supported by Webform allows form values to be populated from the URL.
Setting the default values of a component to use a
The default value of the field populated from the URL.
Setting Default Values from the URL (7.x-4)
To set the default values of a component to use either:
- Query Format: For urls formatted like http://server/node/120?key=bar use
[current-page:query:key]to return key value.,
- Args Format: For urls formatted like http://server/node/120/key use
[current-page:url:args:2]to return key.