This lesson describes how to create forms that will be emailed to a list of addresses.
Create the basic form
If Drupal 6: Go to Content management -> Create content -> Webform in the top menu.
If Drupal 7: Go to Content -> Add Content -> Webform
- Enter the Title of your form and put any instructions or information that you want to appear on the form in the Body field.
- Click the Save button.
Add the fields you wish to include.
In Drupal 7, you will get a easy to use Drag and Drop interface like many popular online form builders.
For Drupal 6, please see the following instructions.
- Enter the label of your first field in the New component name field.
Select the type of field from the drop down list.
- Date - allows a user to enter a date
- E-mail - validates that the entered value is in an email format
- Fieldset - this allows you to group field into a collapsible area that can be collapsed or expanded by default.
- File - allows user to upload a file. You can restrict the file types that are allowed. This should not be used on forms that anonymous users are able to submit.
- Grid - this creates a grid with options across the top and questions down the side. The user selects the option for each question. For example if you would like to create a customer service form where the user rates various questions on a scale of 1-5
- Hidden - this is useful if you want some of the user's attributes included in the email but not displayed on the form, for example email address.
- Markup - we do not recommend that you use this field type unless you are an experienced HTML or PHP developer.
- Page break - this allows you to have your form fields spread across mulitple pages.
- Select options - this allows you to ad radio buttons, check boxes or list boxes
- Textarea - an area with multiple lines where the user can enter text
- Textfield - a single field for entering text
- Time - allows user to enter a time
- Click the Add button.
- Repeat this for all the fields on your form. Each field requires some configuration.
- Check the checkbox in the Mandatory column for any fields that must be entered before the form can be submitted.
- Once all your fields have been added, click the Submit button.
Set up the email (Both Drupal 6 & Drupal 7)
- Click on the E-mails tab.
- Enter one or more email addresses separated by commas.
- Click the Add button.
- You can customized the email subject, from name, and from address.
You can also customize the email that is sent when the form is submitted. By default all the submitted values are included. You can also add:
- %submission_url - The URL for viewing the completed submission.
- %email_values - All included components in a hierarchical structure.
- %email[key] - A formatted value and field label. Elements may be accessed such as %email[fieldset_a][key_b]. Do not include quotes.
- %value[key] - A value without additional formatting. Elements may be accessed such as %value[fieldset_a][key_b]. Do not include quotes
- %username - the SF State ID of the user submitting the form
- %useremail - the email address of the user submitting the form
- %ip_address - the IP address of the computer the form was submitted from
- %site - the name of the website
- %date - the date the form was submitted.
Update the form settings (Both Drupal 6 & Drupal 7)
- Click on the Form settings tab.
- Here you can customize what the confirmation page should say after a user submits the form.
- You can also set how many times a user is allowed to submit the form.
- You can restrict who can submit the form. This does not restrict who can see the form, only submit it.