Create a Webform

Webforms allow content administrators to create forms to be filled out by anonymous visitors (e.g. RSVP or surveys). Webforms have not changed substantially from Drupal 6 to Drupal 7. The main difference is now CAPTCHAs are automatically applied to all webforms. We recommend that you unpublish or disable the webform when it is no longer needed since CAPTCHAs do not provide perfect protection from spam.

Disabling further submissions is easier in Drupal 7. To prevent form submissions, click the Webform tab, then “Form settings,” set the status of the form to “closed” and click “Save configuration.”

Basic Steps

  1. Click “Add content”
  2. Choose Webform
  3. Title your webform and, in the body, enter any text (such as instructions) that you wish to appear above the form. You may want to give it a nice URL alias.
  4. Click Save.
  5. Add questions (form components) to your form.
    1. Click on “form components” under the “Webform” tab. (You will be on the correct page automatically if you just created a new webform.)
    2. Enter the text for each input field in the textbox under label.
    3. Select the desired field type from the dropdown. (See more below.)
    4. Check ‘mandatory’ if a field should be required.
    5. Click ‘Add’
    6. A new page with additional options will display.  If this is a basic textfield, you can usually leave everything on the default settings, scroll to the bottom of the page, and click “save component.”
  6. After adding all form fields, setup e-mail notification if desired.
    1. Under the webform tab, click “e-mails.”
    2. Enter each e-mail separately in Address field and click ‘Add’ after each.
    3. If you have added an e-mail form component to your form, you can select it using the “component value” option and send an email to the form submitter as well.

Organization

There are two main ways to group fields:

  • Fieldsets – groups related fields within a page. In newer sites, fieldsets are themed with a thin border. They can also be collapsible, a nice way to make a really long form less daunting. You can add descriptive text at the top of each fieldset. Note: to actually place fields within a fieldset, you need to drag fields ‘under’ the fieldset component – similar to moving menu items under a ‘parent’ item in the menu administration.
  • Pagebreaks – allows for multi-page forms.  (Note: if you are allowing file upload – only enabled on certain sites – file fields must be on the last page of a multi-page form.) The description at the top of the page will continue to be displayed on each page of the form.

Both of these are added as form components despite not really being form fields. One way of thinking about these is that fieldsets ‘hold’ collections of fields and pagebreaks are the submit buttons at the bottom of each page in a multi-page form.

Most Commonly Used Form Components (Field Types)

Textfield - A one-line box for unformatted (no bold/italics) text. (e.g. Name)

Textarea - A multiple-line box for text with no character limit. (e.g. Comments)

E-mail – Valid email address format. If you want to send your submitters a copy of the form submission, it’s best to use an actual email field versus a textfield.

Select options – These are for drop downs, radio buttons, and checkboxes – anything where you need to give the user a set list of choices. The interface for configuring select option fields is substantially improved in Drupal 7.

  • If you don’t configure the select field at all, it will display as a radio button field. (User can only select one option.)
  • If you check ‘Multiple’, the select field will be displayed as a list of checkboxes. (User can select multiple options.) Note – if you want a single checkbox, you still need to select multiple – just only provide one option.
  • If you do not check ‘Multiple’ and instead check ‘Listbox’, you will get a dropdown. (User can only select one option.)

Form Components You Will Probably Rarely Use

Date and Time – self-explanatory

Grid - Provide multiple questions that the user can rate on a given scale such as 1-5 or "bad, OK, good" Displayed as rows in a table.

Hidden - A field that is not displayed to the submitter with data you want to collect that can be automatically generated.  Note: This is probably something you will never need to use.

Markup – This is for entering something like a 2nd description mid-way through a form. Generally you would use the description field within a fieldset instead.

File – Only enabled on specific sites. It is extremely important for the security of our shared server that if you use a file field that you limit allowed file types to only images, PDFs, and possibly Word documents. You should also limit file size. This is configured on a per-field basis which is why we don’t enable it on all sites. Uploaded webform files are public. They can be accessed directly at the file URL if someone knows it, so you should not be accepting files containing sensitive information. If you have a form that accepts files, make sure to periodically clear your old form results to remove those files, especially if those files contain student work. (Results->Clear)

Accessing Form Results

There are two main methods for getting the results from your webforms.

You can set up the form to automatically e-mail a certain address every time someone submits the form. This is good for forms that require a relatively quick response or that exist for a very long time (e.g. Computing’s “Classroom Request” form).

For surveys or RSVP forms (forms with a set end date), using the Results tab may be more practical. Every time someone submits a webform, a new record is created in the results. You can see a list containing the date and time of each submission. You can also view the results of each submission individually by clicking ‘view’ in the Submissions list. Alternatively, you can view a table of all responses by clicking ‘Table’. (This is only practical in forms with a small number of fields.) You may also export your results to Excel by clicking ‘Download’. Note: if you have a form with hundreds of results, the download may time out.  It might be a good idea to periodically (annually?) download form results to Excel to store a copy and then clear the form results in Drupal to keep the number manageable.