In top form: webforms in Drupal 9

Image by Museums Victoria on Unsplash.

One of the Drupal 9 features we are most excited to see in the WMS is the new webforms. For site managers, webforms in Drupal 9 offer time-saving options such as templates, formatted fields, and pre-filled lists. For end-users, the forms can be simplified and made more compact, and thus appear less daunting.

Time-saving templates

Need a contact form on your site? You no longer need to design it from scratch. When you create a webform, there are several templates available to you. These include the contact, registration, and feedback form templates.

You can edit and clone these templates, removing fields you don’t need, adding others, rearranging, and rewording all the form elements. And you can create your own templates.

More field types, field groups, prepopulated lists

Sometimes a form needs no more than a few simple textboxes, but there are times something more complex is in order. This is where Drupal 9 Webforms shine, making it easier for site managers to design the webforms, and quicker for users to input data in a consistent manner.

  • There is a long list of special field types to make sure users enter data in the correct format.  Field types range from the common (date, number, email) to the esoteric (Likert scale, rating, ordering a list).
  • “Composite elements” provide a group of related fields. An example of this is the address element that includes fields for the street, city, province, and postal code.
  • A variety of prepopulated lists are available, such as those for provinces, countries, gender, and languages, as well as prepopulated Likert scales to assess satisfaction, agreement, or importance. Site managers can edit these lists to suit their needs.
  • Select options can include an “Other” option with a textbox for users to enter an answer not included in the list.
  • You can now change the field type after you have created the field (in Drupal 7 you had to delete the field and start over).

Formatting options to shorten the form

Two fields positioned side by side. A help icon has been clicked and displays help text.

Users are put off by long forms, so Drupal 9 offers formatting options to make your webforms more compact.

  • The “flexbox” allows you to group fields side-by-side to take advantage of the full width of the page.
  • Help for each field can be collapsed, taking up little space until the user needs it.

Take a deeper dive into building forms

If you’d like to take a deeper dive into building forms and templates in Drupal, take a look at this video by Drupal developer Jacob Rockowitz.

Back to top