Validation
Looking at validation for a project at work. The asp forms in .net offer some really nice tools for data validation, but what really has me concerned is what is necessary with form validation. Obviously, there are certain fields that are required, and have a required validator attached to them.
Is All Validation Necessary?
Say your database contains a varchar(50) item that accepts null values. When you are submitting information to that database, should you even check to make sure the data is correct if it is just optional?
When to validate optional data:
- It will be used somewhere else (ex: reports)
- It absolutely must have a certain format (ex: letters only)
- Must have a certain pattern to it
When not to validate optional data:
- It will not be used somewhere else (ex: reports)
- Does not need a certain format, or it isn't important to have an acceptable format (ex: phone numbers could include dashes, but since they can be written so many different ways you can leave them unvalidated if they are not used elsewhere.
No comments:
Post a Comment