Checking what people enter.
WHEN TO VALIDATE
After the person finishes a field, not while typing.
WHY NOT WHILE TYPING
Showing an error before they have finished is hostile and distracting.
WHAT TO VALIDATE IMMEDIATELY
Only what can be judged complete: a selection, a format that is clearly wrong.
WHAT TO SHOW
What is wrong, specifically, next to the field.
WHAT NOT TO SHOW
"Invalid input" An error summary with no indication which field
WHAT TO DO ON SUBMISSION WITH SEVERAL ERRORS
Summarise at the top, with links to each Mark each field Move focus to the first
WHAT TO NEVER DO
Clear the form Lose entered data Reject something a person cannot correct
WHAT TO ACCEPT
Variations in formatting: spaces in card and phone numbers, differing case.
Normalise it yourself rather than rejecting it.
THAT POINT
Rejecting a correctly supplied value because of formatting is an avoidable failure.
WHAT TO CONFIRM
Success, clearly.