Forms done right

Stop scolding your users!

FATAL ERROR! The damage you have caused is irreparable and irredeemable. Shame on you. Please unplug your computer and return it immediately so that it may be re-sold to someone who is not an utterly incompetent fool.
Hyperbole? Barely.

Users don’t do the wrong thing. We do. The user is invested in accomplishing a goal. Why would they do the wrong thing?

Simple: because we have made it easier to do the wrong thing than the right thing.

This is true with any “error” on a site or in an application, but it really stands out when it comes to forms. Let’s talk about forms done right.

So … a user is filling out a form. She enters her email address but makes a mistake. It is not a valid email address.

When she tabs out of the email input (or, worse, when she attempts to submit the form), a big red box appears with a message something like this:

Error! Your email address is invalid. Please try again.

In short: You bozo! Can’t you even get your own email address right?

My view is simple. The bozo here is the developer or designer who created the form, not the user. Users make “mistakes” only because the form (or the controls) invite them to. Forms should make it as difficult as possible to misunderstand what is required or to enter invalid data.

Forms are often difficult to understand. Guessing the intent of the form’s designer is not always easy. I have filled out dozens ⁠— perhaps hundreds ⁠— of forms in which I’ve been stymied by the form. Often, I’ve simply given up.

It is rarely the case that I have no idea what the form expects; rather, it is that I can think of too many possibilities for what it wants, and I can’t tell which one is correct. That’s the mark of a poorly designed form, and they are myriad.

And it is so easy to avoid this. Here is how I approach it:

  1. Every form input should know precisely what valid input looks like. Ideally, we’d have a type system that made very precise runtime type checking possible. One alternative is the HTML Input element’s pattern (external site) attribute.

  2. Every form input should make this information abundantly clear to the user, both before and as the user enters data: in help text and, if possible, an example (but not as a placeholder ⁠— leave the input for input).

  3. Form fields should indicate clearly both visually and non-visually whether a field contains valid input and, if not, what needs to be done to make that input usable.

  4. Instead of a big red X to tell the user that she’s stupid, provide a big green checkmark to indicate success. Reward valid input; never punish for invalid input. Rip out the red and go green.

  5. Whenever practicable, limit input so that only correct input is possible. If a field expects an integer, then the only non-digit character it should accept is a minus sign, and not even that if it’s a positive integer field. If a password cannot contain spaces (and why would you do something dumb like that?), then the password input should not accept spaces either.

  6. Adjust the help as the user enters data. For example: “Remember the @.” Or, for a password field with the (dumb) requirement that the user include digits, letters, and punctuation, as each condition is met, remove it from the help message. So “include at least one number and one punctuation mark” becomes, upon entering a digit, “include at least one punctuation mark”.

  7. Don’t disable the submit button, but indicate in an accessible way whether the form is ready or not. Some smart people will submit a blank form to get the error messages so they see what’s required. But you’re using HELP messages, right? Still, some indication on or near the button to say ready/not ready will help.

  8. Prefill information if you have it! An astonishing and nearly universal example of this is the lost password form. You just tried to log in, but failed, so you click lost password. And despite that you just entered your email address on the login form, you are presented with a blank email address field. Why?

  9. Remember: nothing is wrong, the form is simply incomplete.

  10. Test, test, test. Don’t assume that your form is understandable just because you understand it. Try it on users cold, and ask them to explain their thinking. No hints! Then adapt the form until it is as clear and easy as can be.

Finally, this:

  1. Never require information you don’t absolutely need.

  2. In most instances, if you don’t absolutely need a piece of data, don’t ask for it. You can always give users the opportunity to add more information, either by clicking a button on the form to reveal an “optional” section, or by asking them to come back later to add more. You can even allow them to choose to be reminded.

The simpler and shorter your form, and the more understandable it is, the more likely you are to get users to fill it out properly. By rewarding the user for correct input rather than punishing for incorrect input, you encourage the user to finish the form. And you make it less likely that they will avoid your forms in the future.

When you have mastered the art of forms, your users will sail through them without a glitch. That means happier users, more sales, fewer wrong orders, better feedback, and more users still.

Initialisms and abbreviations
HTML
HyperText Markup Language