Middlebury

Drupal Webform

Part of the documentation on Drupal.

We have set up new sites specifically dedicated to creating Webforms in a more secure, more up-to-date configuration. The process for creating and managing your Webforms is largely unchanged with the exception of the Creating a Webform, Confirmation Message, and Linking to your Webform sections.

Drupal's webform module allows you to set up an online form to collect data and send information to you via email or by downloading an Excel spreadsheet. This should not be used to collect sensitive data. Please review the sensitive data collection matrix to determine whether this is an appropriate system for your data collection needs.

An overview of creating a basic Webform.


Creating a Webform

  1. If your department, office, or program does not already have a space for Webforms on forms.middlebury.edu or forms.miis.edu, we will need to do a little bit of work to create one for you so that it looks like your site on www.middlebury.edu or www.miis.edu and doesn't confuse visitors to your site. To request this, please submit a Helpdesk ticket through the Web Helpdesk interface.
  2. Go to https://forms.middlebury.edu/user or https://forms.miis.edu/user depending on which site you are planning to add your form to and log in with the username and password that you would normally use to edit in Drupal.
  3. Type the address of your department, office, or program's forms site in the address bar. You will have received this address in the response to your Helpdesk ticket in step 1.
  4. Create a new page for your Webform by clicking Add Sub-page in the Sub-pages section of the Edit Console at the top of the page.
  5. In the Page name textbox, type in the title of your form, as you would like it to appear in the left navigation menu then click the Create sub-page button at the bottom of the page.
  6. Click Add under Content in the Edit Console.
  7. Select Webform from the list of content types in the middle of the page.
  8. Enter a Title for your webform.
  9. In the Body section, put any information that you would like to appear before the form, such an instructions.
  10. Click Save

See Linking to your Webform for steps on creating a link from your department, office, or program site to this new form you've created, or the sections below in Adding Form Components to add fields to your form.

Form Permissions

The setting of who can "read", or in this case submit, a piece of content in Drupal is made at the page level, rather than the content level. To ensure that your forms in Drupal can only be submitted by people with a Middlebury account:

  1. Click Settings in the Page section of the Edit Console.
  2. In the Permissions section of the page settings, make sure that the "Read" checkbox to the right of "Everyone" is unchecked.
  3. Add the "institution" group to the Group permissions and give it only "Read" access. The "institution" group can be found within "Groups" and then "General" in the group menu. This group contains everyone at Middlebury, MIIS, the Language Schools, Schools Abroad, etc. You may wish to use a different group if you only want this visible to faculty, staff, and/or students, but "institution" is the go-to group for all Middlebury-related people.
  4. Click the Save Settings button.

Editing a Webform

If you have permission to edit a form, an Edit link will appear at the bottom of the form. Once you click on that the Edit Console at the top of the page will change to have items related to editing the form. The first item, Edit, will be selected by default and allows you to add a title and opening text for the form. The next item, Form Components, can be used to add, modify, or remove fields from your form. See below for a description of each field.

Adding Form Components

After you click the Save button when creating a new Webform, you will be taken to the form components page. If you are editing an existing Webform, you can get to this page by clicking the Edit link at the bottom of the form and then clicking Form components in the Edit Console.

To add a component:

  1. Give the component a unique name. The name:
    • Appears in bold above the interactive part of the component, followed by a colon.
  2. Use the dropdown menu to choose the component type.
    • Information on the 12 component types can be found below.
  3. If you want the component to be mandatory for people submitting the form, make sure the "Mandatory" checkbox is marked.
  4. If you want the submitted value of this component to be contained in email notifications, make sure the "E-mail" checkbox is marked.
  5. Click the "Add" button.
    1. You are now in the editing interface for the form component type you have chosen.
  6. When you are finished setting up the component, click the "Submit" button.
    1. You are returned to the "Form components" page.

To edit an existing component, go to the "Form components" tab in the editing interface for you form and click the "Edit" link next to the component you wish to change. This will bring you to the appropriate form component editing interface.

To reorder existing components, use the icons left of the component names to drag them into the correct order, then click the "Submit" button.

All component types have 3 common fields in their editing interfaces. The "Label" field inherits the name you assigned in the steps above, and is displayed above the interactive piece of your component. The "Default value" field allows you to have parts of your form already filled in. The "Description" field allows you to provide more information for users and is displayed below the interactive portion of the component. The unique portions of each component editing interface are discussed below.

Date

This component type provides a place for users to submit a date: month, day, and year. You have control over what time zone is used and how you want users to provide a year, either a dropdown list or a text field.

Email

This component will give users a text field to provide a valid email address, and only properly formatted addresses will be accepted. You also have the option of sending a copy of the submission email to this address.

If desired you can pre-populate the email address from the currently logged in user's information by checking the relevant box:

User email as the default form value

Fieldset

Video of basic fieldset use.

This component allows you to group other components into boxes. You can choose to make each box collapsible. To put other components into a fieldset, when viewing the list of components, drag the component below the fieldset in the list and then to the right to indent it below the fieldset. Fieldset Indent.png

File

This component allows users to upload files with their submissions. You can control what file types are allowed, how large files can be, and where they are stored. Note: A "File" component must appear after the last "Pagebreak" component.

Grid

This component provides a common set of "Options" for a list of "Questions." Options appear across the top, questions down the left. Each spot in the grid has a radio button, and only one option may be chosen for each question. You are able to randomize the order of the options, questions, or both.

Hidden

This component can be used to store information not shown to users submitting the form.

Markup

This component can be used to insert HTML code into your form.

Pagebreak

This component is used to break your form into pages. The submit button will not be visible until a user completes the final page of the form. Note: If your form has a "File" component, it must appear after the last "Pagebreak" component.

The Pagebreak also lets you set a Conditional rule, which determines how people filling out the form will get to the page. This lets you have an answer to one question on your form lead to a set of other questions. This behavior is sometimes called branching logic. To use this, the Pagebreak must come after at least one other form component. To use this:

  1. Expand the Conditional rules field on the Pagebreak form component configuration screen.
  2. Select the Component whose value will determine whether to show the page.
  3. Select either Is one of or Is not one of to determine whether to show the page.
  4. Enter the Values that will determine whether to show this page.
  5. Click Submit.

Select options

This component allows users to respond to prompts. You can create single response questions (radio buttons, dropdown lists) as well as multiple response questions (checkboxes, multi-select lists).

The Select options component features a GUI interface for adding options. If you want to revert to the manual method for editing options, click the Manual entry link below the option boxes. The value of each item can be entered in the text field contained in each row. If you want to be sent a different value for an option than appears for the user (ex. "One" appears on the form and you are sent "1"), click the Customized keys (Advanced) checkbox and enter the value you wish to be sent in the text field to the left of the value displayed to the user.

The default option for this element can be set by clicking the radio button to the left of the appropriate value. Values can be rearranged by dragging the cross glyph to the left of these radio buttons. You can add a new row below any existing row by clicking the green cross glyph on the right and you can remove any row by clicking the red X glyph on the right. You can also choose to Randomize options by clicking that checkbox to display the options in a random order for each person visiting the form.

If you want to allow people submitting the form to supply their own option if an appropriate one does not appear in the list, check the Allow "Other..." option and enter the appropriate text in the Text for "Other..." option text field.

Textarea

This component provides a box for users to type in. You can make this box resizable.

Textfield

This component provides a single-line text field for users to type in.

If desired, you can supply default values from tokens. For instance the currently-logged-in user's first and last name can be added to a "Name" field using this token:

[current-user:field_first_name] [current-user:field_last_name]

First and last name via tokens.

Time

This component type provides a place for users to submit a time. You can control what time zone is used, as well as whether to use 12-hour (am/pm) or 24-hour format.

Form Settings

This tab contains some of the advanced settings that were previously on the edit form. To get to this tab, after clicking Edit at the bottom of any Webform, click on the Webform tab in the Edit Console and then click on Form settings.

Who can read data submitted to this webform

This section allows you to add individuals or groups to grant permission to view submissions to this webform without granting those people access to edit the form or other content on your site. Keep in mind that any people or groups added here will have access to both the submitted data as well as any files.

Adding a person or group in this section does not automatically add them to the people who receive emails when the form is submitted. You must configure that separately as described in the E-mails documentation.

Confirmation Message

You can, optionally, add a message to appear after a user submits the form. Leaving this blank gives a default message of completion after a user submits the form. It is highly recommended that you use this space to provide a link back to your site on www.middlebury.edu or www.miis.edu.

Redirection Location

A custom redirect URL will bring a user to that page after submitting the form. If you need to create a brand new page to contain your custom confirmation message, you will want to create the page on www.middlebury.edu or www.miis.edu to add basic content. If you leave this blank or choose the confirmation message, the user will see that message instead. You can also choose not to redirect the user, which will reload the current form page when they submit the form.

Submission Limit

This area allows you to limit user submissions. By default, a user can submit an unlimited number of responses, but you can restrict them to a specified number of submissions over a specified amount of time.

Advanced Settings

You can ignore the Available as block and Show complete form in teaser checkboxes as the way we have set up the Middlebury website make these options unnecessary. The option of interest here is Allow users to save a draft. This option is only useful if your form requires users to sign in before filling it out. If you use this option on a form that allows anonymous users to submit it, it may behave erratically. However, if you require people to sign in to fill out your form and this option is selected, they will be allowed to save a draft of their form submission. This will not send emails from the form, but they will be able to come back to the form at a later time and complete their form submission. This is a good option if you have a very long form, especially one that requires people to gather written materials or files before they submit it.

This section also allows you to change the text of the submit button, which is Submit by default.

E-mails

When editing the webform, under Webform -> E-mails, any email addresses specified in "E-mail to" will receive an email when the form is submitted.

This video describes:

  1. sending email for each form submission
  2. changing the recipient based on conditional values
  3. creating a list of recipients to choose from


See the article on Drupal Webform Email templates for more information.


Email Resending

By default emails will be resent whenever form submissions are updated.

If you need to edit submissions after they are made and don't want emails going out for subsequent updates, you can uncheck the box under Form Settings » Submission Settings to "Re-send emails on update", as shown below:

Setting to change to halt email re-send on update

Form validation

Form validation allows you to create rules that will check the integrity of the data people have submitted. For example, if you have a field that collects a ZIP code, you may want to check that the value entered is between five and ten characters in length. If the person submitting the form enters a two digit ZIP code, they would receive a message letting them know of the issue and asking them to correct it and re-submit the form.

To Add a validation rule, click the Form validation tab in the Edit Console. Click on the type of rule to add to the form. There are explanations of each type of rule to their right. Enter a Rule name, which is just seen by you and helps you remember why you added this rule to the form. Then select the Components to which this rule applies and fill in any other values that help create the rule.

You can Edit or Delete existing validation rules by revisiting this tab at any time.

Results

In the Download tab for form Results there are two options that can help you when exporting form information to Microsoft Excel or another analysis program. Select list options allows you to choose whether to use human-readable or shorter column headers. You can also choose to export multi-values fields as separate columns or as a compact, comma-delimited list. In the Included export components fieldset, you can decide which of the components to include, which is helpful if you are only interested in analyzing a sub-set of the form information.

If your webform accepted file uploaded, they will not be included in this export, but the CSV will have links to those files. If you would like to store the files locally, you can open the CSV and click on the links to download each of the submitted files to your local machine.

Linking to your Webform

To have a link to your new Webform appear in the left navigation menu of your site on www.middlebury.edu or www.miis.edu:

  1. Navigate to your regular site on www.middlebury.edu or www.miis.edu and log in.
  2. Click on Create sub-page in the Sub-pages section of the Edit console
  3. In the Page name textbox, type in the title of your form, as you would like it to appear in the left navigation menu and the last portion of the URL from the address of your form on the forms site in the Page URL textbox (e.g. if your form is at https://forms.middlebury.edu/academics/dept/spring-semester-form enter "spring-semester-form" in the Page URL textbox) and click the Create sub-page button.
  4. Click Add in the Contents section of the Edit Console.
  5. Click the Redirector link in the center section of the page.
  6. In the Destination URL textbox, enter the URL of the form on forms.middlebury.edu or forms.miis.edu and click Save.

Closing or Deleting a Webform

If you no longer need to collect information from your form, or if it is on www.middlebury.edu and you have already created a new version on forms.middlebury.edu, it is a good idea to close or delete the form. Doing this limits the chances that information from the form will be accidentally exposed, that the form will be used by spammers to flood your inbox, and will help our website perform better.

Backing up your Data

Before closing or deleting a form, you can download a copy of the submissions that you can keep on MiddFiles. See the Results section of this documentation for more information.

Closing a Webform

Closing a Webform will prevent additional submissions to the form, though it will still appear on your site with a message letting people know that it is now closed. This is useful for forms that you want to temporarily disable, but will allow submissions to in the future. To activate this option:

  1. Click Edit at the bottom of the Webform.
  2. Click on Form Settings in the Edit Console.
  3. In the Status of this form section, select Closed.
  4. Click Save configuration.

Deleting a Webform

If you no longer need the form, we would appreciate it if you would delete the content. You can do this by clicking Delete at the bottom of the Webform. This will move the Webform into a [Recycle Bin] page below the current page in the navigation menu. When the Webform is in the [Recycle Bin] editors can still access the data that was submitted to the Webform in the Results section, but new submissions will not be allowed and the form will not appear publicly on your site.

If you are truly satisfied that you will no longer need the Webform, there is a Delete permanently option available after you have put the Webform in the Recycle Bin. Once the form has been deleted permanently, it cannot be recovered and all submitted data (including files) are removed from the website database.

Finding your Webforms

We provide two lists that Webform editors can use to locate all of the forms on www.middlebury.edu they are responsible for editing.

http://www.middlebury.edu/middlebury_my_webforms will show all of the forms on the site that the currently logged in user has access to edit.

http://www.middlebury.edu/middlebury_our_webforms/###### will show all of the forms within a particular area of the site. Replace the "######" with the page ID of the portion of the site you want to look at. The page ID is the number in parentheses in the Edit Console.

Powered by MediaWiki