For Web developers, form validation is a basic task, and yet one that
presents some interesting challenges. Even discounting security issues such
as SQL injection attacks and cross-site scripting (XSS), form validation is a
critical step in your error handling strategy.
The two criteria I use to plan a form validation approach are extensibility
and simplicity. Forms will change over time. It's like death and taxes, and
much like those two events it's a lot better to plan for them before the
fact, rather than after. When your form changes, how easy will it be to
change your validation? When your business rules change, as they often do,
how easy will it be to update your validation? How easy will it be for
someone else to update your validation code if they were not a part... (more)