Webform Exercises

Last revision:

Activity 1

Create a "Training Registration" webform with the following elements:

  • name
  • email
  • training category
    • "Drupal front-end development"
    • "Drupal back-end development"

When "Drupal front-end development" is selected, a new field appears, that lets the user select "basic theming" or "advanced theming".

When "Drupal back-end development" is selected, a new field appears, that lets the user select "basic module development" or "advanced module development".

The form can only be filled in once per user (regardless of whether the form is submitted as a stand-alone form, as a block, or embedded in a node).

All fields are mandatory.

Activity 2

Create a "Product Order" form with the following elements:

  • product(s) (select one or more options)
  • name (of the user)
  • email
  • "Would you like an invoice?" (yes/no)
    • if set to "yes", make the next field (VAT/Tax) writable
    • "VAT ID / Tax ID" (text field, initially set to read-only)

Activity 3

  • Change the Contact webform configuration so anonymous users can view their submission via a special link.
Hints
  • As an administrator you can see this link in the submission's details as part of the Submission Information tab. Copy the link and try it in a different browser, or when logged out, to make sure anonymous users can use this link.

Activity 4

Create a webform that only lets anonymous visitors enter into a lottery by filling in their email address.

This form can only be submitted once per email address.

Hints
  • In other words, when someone submits the form, they should not be able to enter an email address that was previously used when submitting this form.

Activity 5

Create a webform that employees can use to make a complaint. This form deals with sensitive information, so the law imposes certain restrictions to protect employees:

  • the form may not ask for any identifying user information (name, email, ...)
  • the form must only be available to anonymous users
  • the form may not log the user's IP address.

Activity 6

Make an event feedback / survey form with 5 questions (form elements), each of which must use a different element type.

Be sure to go through the "advanced" and "options" element groups and choose elements you would expect to find on a survey form.

Be sure to have a look at the "likert" element and the predefined options you find at Administration > Webform > Options.

Activity 7

Create a webform that: