Advanced guide: Building Drupal webforms
Looking for basic information on how to create a webform? Read this guide first.
This guide walks through the options available for building a webform in the Drupal CMS. Not all of the settings visible in the CMS back-end are configured to work/display on the front-end.
This form is attempting to document what will work, but is a work-in-progress that will continue to be updated as the Drupal webforms functionality improves.
On this page:
Form elements
Not all of the elements, options and settings visible in the CMS back-end are configured to work or display correctly on the front-end.
See our sample webform that shows all available elements and their most typical customisations and variations.
Element name | Supported? | Use case |
---|---|---|
Checkbox | YES |
|
Hidden | YES | TBC |
Textarea | YES |
|
Text field | YES |
|
YES |
| |
Height (feet/inches) | NO |
|
Number | YES |
|
Privacy statement | YES |
|
Telephone | YES | TBC |
URL | YES | Will only accept a URL that includes “https://www.” at the start. If using this element, please include this information in the description field, as there isn’t a specific error message that tells the user this is the problem. It may be a safer option to use the Text field element instead, to account for users who provide different variations of URLs. |
Advanced address | YES | Can’t apply conditional logic to this element. |
Advanced HTML/Text | YES | Use this when you want to include text within your form that isn’t a question / doesn’t require an answer. For example, when creating a decision tree and wanting to supply an answer or more context at the end of a pathway. This element includes more WYSIWYG toolbar options than the Basic HTML element. Includes the basics of heading sizes, bold and italics, hyperlinks and list formatting as well as extra options such as adding buttons and call-out formatting. |
Basic HTML | YES | Same use case as the Advanced HTML/Text element, but with less WYSIWYG toolbar options. Includes the basics of heading sizes, bold and italics, hyperlinks and list formatting. |
Horizontal rule | YES | Applies a horizontal line within your form. Use sparingly, if at all. |
Label | YES | TBC |
Date | YES | TBC |
Checkboxes | YES with some limitations | Only the “Custom options” option is supported; the predefined options are not. |
Radios | YES with some limitations | Only the “Custom options” option is supported; the predefined options are not. For example, to set up a question with Yes and No options as the response, select “Custom options” and then add “Yes” and “No” as the 2 values. |
Select | YES with some limitations | Only the “Custom options” option is supported; the predefined options are not. Only single select is supported; multi-select is not. |
Submit button(s) | YES with some limitations | Only the Submit version is supported (not save, etc.) The 1.45 release allows for conditional logic to be applied to the submit button. |
Term select | YES | Dropdown list that allows multiple selects, must be linked to taxonomy |
General tab
Element settings, options and description text
Field | Supported? | Use case or example |
---|---|---|
Title | YES |
|
Allowed number of values | NO |
|
Options | YES |
|
Options display Options description display | NO NO |
|
Empty option | YES |
|
Empty value | NO |
|
Sort options | NO |
|
Randomize options | NO |
|
Select2 | NO |
|
Choices | NO |
|
Description | YES |
|
Help text | NO |
|
Help title | NO |
|
More text | NO |
|
More title | NO |
|
Form display
Field | Supported? | Use case or example |
---|---|---|
Title display | NO |
|
Description display | NO |
|
Help display | NO |
|
Field prefix and Field suffix | NO |
|
Minlength and Maxlength | YES |
|
Size | NO |
|
Placeholder | YES |
|
Autocomplete + autofill | NO |
|
Input masks | NO |
|
Input hiding | NO |
|
Disabled | NO |
|
Readonly | NO |
|
Prepopulate | NO |
|
Form validation
Field | Secondary fields | Supported? | Use case or example |
---|---|---|---|
Required | YES | The user must enter a value for this element or they can’t submit the form | |
| Required message | YES |
|
Unique |
| NO |
|
Pattern |
| NO |
|
Counter | YES |
| |
| Counter minimum and maximum | YES |
|
| Counter maximum message | NO |
|
Conditions tab (conditional logic)
State | Supported? | Use case or example |
---|---|---|
Visible | YES |
|
Hidden | YES |
|
Visible (Slide) | NO |
|
Hidden (Slide) | NO |
|
Enabled | YES |
|
Disabled | YES |
|
Read/write | NO |
|
Read-only | NO |
|
Required | YES |
|
Optional | NO |
|
Operators | Supported? | Use case or example |
---|---|---|
All | YES |
|
Any | YES |
|
One | YES |
|
Choose the element (i.e. the question/field on the form) that will affect whether this current element gets triggered.
For example:
You’re editing the Conditions of an email element.
You select the state to be Visible > if One of the following is met
In the next dropdown menu choose the Radios element you have labelled “Do you want to be emailed?”
Assign the trigger to be Value is
Select the value Yes.
Trigger/value | Supported? | Use case or example |
---|---|---|
Empty | YES |
|
Filled | YES |
|
Checked | YES | Use when the question the logic applies to is using the Checkbox or Checkboxes element. |
Unchecked | YES | Use when the question the logic applies to is using the Checkbox or Checkboxes element. |
Value is | YES | You will also need to select the specific value that should trigger this element. |
Value is not | YES |
|
Pattern | YES |
|
Not pattern | YES |
|
Less than | YES |
|
Less than/Equal to | TBC | TBC |
Greater than | YES |
|
Greater than/Equal to | TBC | TBC |
Between | TBC | TBC |
Not between | TBC | TBC |
Currently only a single state of conditional logic is supported. For example: You can set a field up to become visible based on logic, but not also to be hidden based on different logic.
It’s also not possible to create multiple versions of the same ‘state’. For example: you can’t set up conditional logic make a field “visible” if it meets A + B or C. The only option is to set up 1 “visible” state that has the requirements of meeting either “ANY” (A or B or C) or “ALL” (A and B and C) options provided.
Advanced tab
Access tab
Customising the settings for the entire form
Information about what’s configured or not configured in the Settings tab is available in our Advanced guide: Drupal webform settings.