Drupal Webform

The Webforms feature allows you to collect information from anonymous site visitors. Uses for this feature include surveys, multi-page questionnaires, polls, event registration forms, and lead generation pages.

Forms features a basic analysis of the results collected. If this is insufficient, you can download the data off your site for further analysis and use in any spreadsheet.

For information about viewing the results of your webforms, see Webform results.

Webform typically is used when performing data collection that is a one-way communication, that is, many users submitting values to a very small set of administrators. Webform is not a front end for letting users create custom nodes. Webform submissions are not nodes. This means that you can't use Views with submissions, setup custom access permissions to submissions, or do just about anything with them outside of what Webform provides for you.

Webform Components

Webform components are basically the equivalent of CCK fields. You can add any number of fields to a node that an end-user can fill out. All components are included with the Webform module. These include:

  • date
  • email
  • fieldset
  • file
  • grid
  • hidden
  • markup
  • pagebreak
  • select
  • textarea
  • textfield
  • time

To read how to make checkboxes, radio buttons/groups, and menus/lists then read the Webform Field Types portion of this doc.

Creating webforms

To create a new webform:

  1. In the shortcut bar, select Add content, and then click the Webform link.

    Create Webform page

  2. Enter a Title for the webform, such as Survey.
  3. Construct the webform by either dragging fields from the Fields list on the left into the editing area on the right.

    Adding fields to the webform

    Adding the first field into the editing area automatically adds a Submit button to the webform.

    You can rearrange the fields at any time during the webform creation process.

  4. In the editing area, click on each field to view the fields' editable attributes on the left. For more information about the different fields and their attributes, see the Customizing fields section of this page.

    Editing field settings

  5. Use the vertical tabs at the bottom of the page to set additional attributes for your webform, including menu links, a custom URL, and other special settings. For more information, see the Customizing the webform section of this page.
  6. Click Publish.

Drupal Gardens creates the webform based on your settings. To view the created webform, in the admin menu, select Find content.

edit tab.

Customizing fields

Each field that you select for your webform has additional attributes that you can modify in order to ensure that you're collecting the required information from the person filling out the form.

When you select a displayed field in the webform in order to edit it, the field's attributes appear on the left of the page in the Field settings tab. For each field, the Field settings tab contains an accordion view of that field's Properties, Display, and Validation attributes.

Text field
A single-line text entry field.

Multi-line text field
A multi-line text entry field.

Radio buttons
Obtains a single choice from a list of items.

Check boxes
Obtains one or more choices from a list of items.

Drop-down list
Obtains a single choice from a list of items.

E-mail
Only accepts valid e-mail addresses as input.

File upload
Allow visitors to include files as part of their submission. You can use this for users to include photographs, music, documentation, resumes and more.

Page break
Insert one or more page breaks to create a multi-page form. This can help you keep question pages short and simple.

Formatted content
Enter explanatory texts, instructions, images and so on. To format and organize the text, select a text format and use the HTML formatting it supports.

Fieldset
Organize fields into groups on the page. Simply drag a fieldset into place, then drag one or more fields into it.

Hidden field
This field and its contents are not visible to your site visitors. You can use it to label results from different forms, different versions of the same form, add reminders to site admins about processing deadlines or anything else you need. Setting a default value will return it with the rest of the results submitted by your site visitors, such as a survey version number.

Customizing the webform

The panels at the bottom of the webform page include several customization options for the webform.

The Form settings panel provides customization options specific to webforms, including how they handle user data submissions, access, and other advanced settings.

Form settings panel

For information about the other available panels on the page, see Common content settings.

Submission settings

  • Customize confirmation check box - Configure your website's actions when a user submits a response to this webform.

    Select from the following form submit options in the drop-down menu:

    • Show standard confirmation page - Displays a confirmation page that contains the information you enter in the Page body field.
    • Redirect to a different page - Redirects users to the page in the Path field. You can also display a confirmation message by selecting the Show a confirmation message check box, and then entering information in the Page body field.
    • Stay on the same page - Users stay on the webform page. You can also display a confirmation message by selecting the Show a confirmation message check box, and then entering information in the Page body field.
  • Enable spam protection (Mollom) check box - Use Mollom to protect webform comments from spam.

    For more information about Mollom, see Mollom. This check box is enabled by default.

  • Limit submissions check box - Limit how often visitors can submit the webform to protect against spam.

    When you select this check box, additional settings appear which allow you to set a visitor's number of allowed submissions for a period of time.

  • Send a confirmation e-mail check box - Send a notification email to an administrative account (that you select) for each submitted webform.

    When you select this check box, additional fields appear for the email message:

    • To - The email address to which Drupal Gardens sends notification emails. This field only supports a single email address. To send notification emails to multiple recipients, create a mailing list on your email server that contains all of the required recipients.
    • Subject - The subject of the notification email.
    • Body - The formatted text of the notification email. You can also add tokens to the email to send visitor information and webform results. For more information, see the Using tokens with notification emails section of this page.

Submission access

Use this section to set which user roles can access and submit your form. For more information about user roles, see User roles and permissions.

Submission access section

Advanced settings

  • Create a block - Your forms can appear in blocks as well as on their own pages. Select this option, save your form, then go to the Blocks page to enable and configure its block. For more information, see Blocks .
  • Show complete form in teaser - If your form is displayed on your front page or blog page as a teaser, depending on your settings, it might be cut off after a certain number of lines or characters. Select this option to prevent this from happening.
  • Display a link to previous submissions - This option displays a link to the previous submission by visitors who have already submitted your form.

Using tokens with notification emails

Tokens allow you to configure the notification email for each webform submission to include information including the user's IP address, the date/time of submission, the user's email, and more. Your notification emails can even include values from the completed form.

To add tokens to a notification email, in the Body field, enter tokens from the Token values section. For example, if you want the notification email to include all of the visitor's webform results, include the %email_valuesin the Body field.

Token use in notification email

Note: Several tokens include a key, which allows you to obtain token information from a field on a webform. Each field on a webform has a Machine name, which is displayed under the Label field in Field settings > Properties.

Machine name

For example, if you want to display the formatted field label and value for a specific webform field, use the %email[key]token, and replace keywith the field's machine name (example, %email[new_1334599733011]).

Theming

The THEMING.txt file included with the module package has guidelines for theming with instructions on how to customize submitted e-mails, confirmation pages, and the display of the form itself.