Validation is an automated check to guarantee that the data input is rational and acceptable. It does not check the correctness of data.
For example, a coffee shop is hiring baristas aged 18 to 25. The system can be programmed to only accept numbers between 18 and 25 for the age field. This is called a range check.
However, this does not guarantee that the number entered is correct. An applicant’s age might be 20, but if 18 is entered it will still be valid but incorrect.
Validation is a way of trying to lessen the number of errors in the data input.
The validation is carried out by the computer when you input data. It is a way of checking the input data against the set of validation rules.
The purpose of validation is to make sure that data is logical, rational, complete and within acceptable limits.
There are several validation methods that can be used to check the input data.
- Range Check – generally used when working with data which contains numbers, currency or date and time.
A range check lets you set appropriate limits:
|Upper limit||The maximum price of any item in a shop is $10.||<=10|
|Lower limit||In a shop all items have a corresponding cost.||>=0|
|A range||Number of hours worked must be less than or equal to 8 but more than 0.||>0 and <=8|
- Type Check – warrants that the correct data type is inputted.
For example, in an application form age may range from 0 to 100. A number data type would be an appropriate choice for this data. By defining the data type as number, only numbers are allowed in the field, e.g. 18, 20, 25 and you would keep anyone from trying to input text like ‘eighteen’.
Some data types are capable of doing an extra type check. For example, a date data type will ensure that a date inputted existed or can exist in the future. It would not accept the date 30/02/2018.
- Check Digit – this is used when you want to be certain that a series of numbers has been entered correctly. There are many ways to produce check digits.
For example, the ISBN-10 numbering system for books use ‘Modulo-11’ division. In modulo division, the answer is the remainder of the division.
- Length Check – this is used to make sure that the exact number of characters are entered into the field. It is not too short nor too long.
For example, a password that is required to be 8 characters long. The length check will ensure that exactly 8 characters are entered into the field.
- Lookup – helps lessen errors in a field with limited list of values.
For example, there are only 12 possible months in a year.
Advantages of a lookup list are as follows:
- Faster data entry because it is typically much faster to select from a list than to type each individual entry.
- Enhanced accuracy because it lessens the risk of spelling mistakes.
- Limits the options to choose from by only displaying the essential choices.
- Format Check – checks that the input data is in the right format.
For example, a National Insurance number is in the form XX 99 99 99 XX where X is any letter and 9 is any number.
- Presence Check – makes sure that an essential or required field cannot be left blank, it must be filled in. If someone attempts to leave the field blank, then an error message will be displayed, and you won’t be able to proceed to the next step or save any other data which you have entered.