
Nobody can get forms right. Some fare better than others, and some are downright awful. I am a very critical person, and I could probably nit-pick about a problem in just about any form you present to me. Usually I just shrug off minor problems or annoyances, but this morning I came across one of my biggest pet peeves: bad validation. In this case, they were asking for a phone number, and for some reason required a very specific format - but didn’t bother making it clear what that format should be. And this was not for some mom & pop contact form on their MySpace page; this was an MSDN subscription activation. See for yourself:

I am not sure who coded the validation for this form, but “Phone is invalid” is clearly not enough information for me to fix the problem. I use xxx.xxx.xxxx notation successfully on a lot of forms; why isn’t it accepted here? Next, I tried (xxx) xxx-xxxx. This was rejected as well. Why? For fear of being ostracized, I will not tell you how many tries it took before I guessed right, and passed the validation. As it turned out, they were expecting numbers and dashes with no spaces: xxx-xxx-xxxx. When I finally got it right, I was very surprised to not see a hateful message along the lines of, “Way to go, moron! It only took you n tries. Welcome to step 2!”
So MSDN (and anyone else who codes validation this way): Why do you require a specific format in the first place? Is it because you blindly pass the string value back to your database, and the check constraint on that column kicks out anything else? Why can’t you massage the data on the way in? In all honesty, if you are collecting North American data only, you should be able to accept ANY format that contains 10 numeric digits, and simply strip away the rest. (And if you are more international, you can clearly perform conditional stripping and check for the relevant number of digits.) The punctuation is not important, and whether or not I can guess the format you’re expecting should not impede my ability to give you my information.
More importantly, if you are unwilling to write more lenient validation routines, at least make your error messages more friendly (it is not hard to add “; expected format: xxx-xxx-xxxx” to the above error message). Or even go so far as to make the label next to the text field read something like, “Phone (xxx-xxx-xxxx)” instead of just “Phone.”
This is a big and growing problem with web forms, in my humble opinion. You can’t expect and demand very rigid formats while allowing people to fill in free text data, and then scold them for not guessing right… which is what they have to do when you don’t provide enough information. While right now it is often taking a back seat, it seems only a matter of time before usability will not even be invited along for the ride.
Aaron Bertrand
Senior Data Architect, OTOlabs
http://www.otolabs.com