Validating Data Nicely
Validating form data is, of course, very important. You want to make sure that you get the data you asked for, in the correct format. When users make a mistake entering data or forget to complete a field, you need to get them to fix it. In doing so, however, make sure you don't unintentionally upset them or make the process a pain. Whether you're validating data on the client side or the server side, here's what you can do to make validating your forms easier and more intuitive:
Prefill predictable answers, to prevent typing mistakes.
Avoid cryptic messages.
Don't make your users feel bad or stupid.
Prefill Predictable Answers to Prevent Typing Mistakes
As mentioned earlier, providing a list box or drop-down menu for your users to select an item from can save them time. Prefilled answers also impact the validation logic, but in a good way.
By prefilling predictable answers into a drop-down menu or list box, you reduce the complexity of the validation logic. What would normally require trimming strings to remove leading and trailing spaces, converting to all upper or lower case (or vice versa), and checking for the exact format you're looking for becomes simply checking for a value other than "" or null.
Avoid Cryptic Error Messages
When a user does make a mistake, be clear about what you need him to do. If the user forgets to fill in the first name and last name, tell him in plain English; something like this:
Please fill in the following fields:
First name
Last name
Instead of this:
Error. Missing data: formfield5, formfield6.
Don't Make Your Users Feel Bad or Stupid
When a user forgets to fill in a field or when a user provides incorrect or incomplete data, let him knowbut don't make him feel bad or stupid. Remind the user nicely:
Please fill in the following fields:
First name
ZIP code
Avoid using verbiage that makes users feel like they did something bad:
You did not provide the necessary data:
First name
ZIP code
If a user didn't type a valid e-mail address, politely let him know and then explain how to fix it:
Oops! The e-mail address you entered seems to be missing the @ symbol. A valid e-mail address looks like this: johndoe@aol.com.
Don't make a user feel stupid, with something like this:
You did not enter a valid e-mail address. Re-enter now.