Drupal forms; why they suck and what you can do about it

Dupal sucks: forms

Forms are everywhere, whether they're asking users to register, comment on a post or submit an enquiry we ask users for a variety of information. Such actions should be as easy for the user as possible. Drupal core does the job but it's not as friendly or easy as it could be, below are a few modules you can use to greatly improve the experience.

General Validation

Drupals validation works, but it could work so much better. By default it kicks the user to the top of the page with a wall of red - not very user friendly. The first way you can improve this is with the Inline Form Errors (IFE) module. This does exactly what it says on the tin; it removes all error messages from the top of the page and places them under the fields themselves.

This can be attached to all forms but the downside is that you'll need to manually add the form id to the admin config page - not handy if you're creating large amounts of webforms.

IFE is just one of the modules you can use to enhance form validation, this comparison shows others.

Registering an account

Depending on the purpose of the site allowing users to easily register may be vital. There are other modules you can use to tailor the registration process which I blogged about here, but for the actual form the module Friendly Register is a beautifully simply idea. When a user types in a username it validates it to see if it's available and lets them know. When they type in an email it validates to make sure it doesn't already exist, if it does it displays links to login and forgotten password.

Webforms

We all know about the webform module, the next version of this (currently at beta-1) adds conditionals to fields - previously done via another module. Allowing you to show or hide fields depending on values entered into other fields.

Alongside webform is a wide array of other add-on modules, a few of which that aim at helping the user complete forms are:

Select or other - "Provides a new Forms API element which is a select/radios/checkboxes element that has an 'other' option. When 'other' is selected a textfield appears for the user to provide a custom value." - a useful module though there are still a few issues with it so use with caution.

Webform draggable list - Creates a list that the user can drag and drop to order - perfect example of where this is useful is asking a user to rate how important a list of issues are to them. The alternative to this is a grid or multiple select lists.

Webform fivestar - Integrates the fivestar module - when asked to rate something would you rather select a number or click on a pretty star?

The end bit

The above has all been about functionality, other major factors are the design and the language the form uses. Getting a form right can be tricky, thinking about the target users and what you want to get from them. Thinking about the goals will help you to create something users will want to complete and won't get scared by. Until next time!