Webforms come with some complex components that require additional configuration.
To add an advanced component:
- Navigate to the webform.
- Click "Webform."
- Type the name for a new date component in the text box.
- Select the component type from the "Type" select box.
- Click "Add."
- Click "Save component."
The component types are as follows:
Date and Time
A date component accepts input from the learner in the form of a date.
A date component accepts input from the learner in the form of a 12-hour format or a 24-hour military format.
Fieldset
A fieldset can contain other fields. After adding a new fieldset:
- Configure the additional options that are supported by Fieldset:
"Collapsible" - If this fieldset is collapsible, the learner may open or close the fieldset by clicking it.
"Collapsed by default" - Select this option to default the fieldset to "closed." The learner must click the fieldset to see the fields inside. - Click the "Save component" button to save the component.
- Proceed to Reordering webform fields, where fields can be moved into the new fieldset.
Grid
Use the "grid" field to collect likert-style data.
A "grid" field asks the same options for multiple questions. After adding the grid component:
- In the "options" text area, define a list of possible options. A "safe key" must be associated with each option. For example:
bad|Bad
good|Good
excellent|Excellent - In the "questions" text area, define the questions that will be asked. A "safe key" must be associated with each question. For example:
quality_of_material|How would you rate the quality of this material?
knowledge_of_topic|How would you rate your knowledge of the topic? - Click "Save component."
Hidden
A hidden field stores a value that the learner cannot change. It should only be used in special cases, such as pulling information from a token and injecting it into a field. After adding a hidden component:
- Unless otherwise specified, "Secure value" should be selected for the "Hidden type" option.
- In the "Default value" field, a value may be entered that will show up on the webform results. For example, to see the last login date of the submitter in the webform results, enter this for the default value:
User login time: [current-user:last-login:short] - Click "Save component."
When a learner completes the form and submits it, the learner's last login date will be stored with the form's results.
To collect a user's browser user agent information in a webform automatically, add the [server:http_user_agent]
token to a hidden field.
Markup
With the markup component, custom text can display (including HTML) to the learner at any point during the form. After adding a markup component:
- In the "Value" text area, enter text to display on the form.
- Click "Save component."
Page break
A page break "field" can be used to distribute webform fields across multiple pages.
To change how multi-page webforms operate:
- Click the "Webform" tab.
- Click the "Form settings" sub tab.
- Click the "Progress bar" heading.
- Configure the progress bar behavior.
- Click "Save configuration."
Select options
A select options component accepts input from the learner in the form of a dropdown box. After adding a select options component:
- In the "Options" text area, define a list of possible options. A "safe key" must be associated with each option. For example:
bad|Bad
good|Good
excellent|Excellent - Click the "Save component" button to save the component.