In this week’s Best Practice of the Week, we’re talking about error messages and how they convey problems to users. Error messages should be specific and let the user know what they need to do to fix it.

We’ve all seen forms where one error message is used for every field — or one sentence is meant to cover the entire form. When you’re indicating errors on form fields, they need to say something more specific than “Error” or “Invalid field.” This is critical for instances where one error is triggered on a form or multiple errors are triggered.

List of vague errors: 'Firstname is invalid, Lastname is invalid, Date of birth is invalid'

Let’s assume that there’s enough information already to let users know what they need to complete before it’s submitted. Required fields are marked and help is available for any special requirements (like format and length).

Instead of a vague error message for the entire page, we want to identify errors at the field level. But, we want these messages to be more specific and clear to guide the user to quickly fix the field and move onto the next step.

There are a lot of different reasons why there might be problems with a form. Here are just a few reasons that might trigger validation:

  1. A field that is required was left blank
  2. Data in a field isn’t in the correct format (Also, consider handling multiple formats for common items like postal codes and dates)
  3. Data in a field isn’t quite right (like an email address missing an @ character, an invalid credit card number, or a password that doesn’t have enough characters)
  4. Data in the field needs to be unique (such as a username that is taken)
  5. A set of double-entry fields (for checking a password was entered correctly twice) don’t match

No single error message is going to cover all of these situations.

You wouldn’t respond to someone in person by saying “Invalid entry.” So, think about writing error messages that use more natural language. Error messages should also match the tone of the rest of the copy of your web site. No one wants a tone that just says “Name invalid.” Think about the validation that is triggered and what sort of cases we need.

A field for date of birth might need multiple error messages depending on business requirements:

  • We need you to provide your birthday. This information is not displayed in your profile.
  • The date of birth you entered is in the future. Please check your date of birth.
  • Based on your date of birth, you don’t qualify for our program.

We want to ensure that all of the possible cases are covered with clear messages that help users fix problems and get to the next step.