Data validation best practices: how can I better construct user feedback?
- by Cory Larson
Data validation, whether it be domain object, form, or any other type of input validation, could theoretically be part of any development effort, no matter its size or complexity. I sometimes find myself writing informational or error messages that might seem harsh or demanding to unsuspecting users, and frankly I feel like there must be a better way to describe the validation problem to the user.
I know that this topic is subjective and argumentative. I've migrated this question from StackOverflow where I originally asked it with little response.
Basically, I'm looking for good resources on data validation and user feedback that results from it at a theoretical level. Topics and questions I'm interested in are:
Content
Should I be describing what the user did correctly or incorrectly, or simply what was expected?
How much detail can the user read before they get annoyed? (e.g. Is "Username cannot exceed 20 characters." enough, or should it be described more fully, such as "The username cannot be empty, and must be at least 6 characters but cannot exceed 30 characters."?)
Grammar
How do I decide between phrases like "must not," "may not," or "cannot"?
Delivery
This can depend on the project, but how should the information be delivered to the user?
Should it be obtrusive (e.g. JavaScript alerts) or friendly?
Should they be displayed prominently? Immediately (i.e. without confirmation steps, etc.)?
Logging
Do you bother logging validation errors?
Internationalization
Some cultures prefer or better understand directness over subtlety and vice-versa (e.g. "Don't do that!" vs. "Please check what you've done."). How do I cater to the majority of users?
I may edit this list as I think more about the topic, but I'm genuinely interested in proper user feedback techniques. I'm looking for things like research results, poll results, etc.
I've developed and refined my own techniques over the years that users seem to be okay with, but I work in an environment where the users prefer to adapt to what you give them over speaking up about things they don't like.
I'm interested in hearing your experiences in addition to any resources to which you may be able to point me.