Validation is an automated check, performed to guarantee that the data input is rational and acceptable. It does not check the correctness of the data itself.
As an example, let’s assume 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, just 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 a given set of validation rules.
The purpose of validation is to make sure any given set of 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 – this is generally used when working with data which contains numbers, currency, or date and time values.
- 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 – this is a way to confirm 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 it would prevent people from inputting verbal data, 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 at some point in the past, or will exist in the future. It would not, for example, accept the date 30/02/2018.
Check Digit – this is used to find out if a series of numbers has been keyed correctly. There are many ways to produce check digits.
- For example, the ISBN-10 numbering system for books uses ‘Modulo-11’ division, where it outputs the remainder of the division as the result of the operation.
Length Check – this is used to make sure that the correct number of characters are entered into the field. It confirms that the character string entered is neither too short nor too long.
- For example, consider a password that needs to be 8 characters long. The length check will ensure that exactly 8 characters are entered into the field.
Lookup – this helps to lessen errors in a field with a limited list of values.
- For example, the fact that there are only 12 possible months in a year ensures that the list of possible values is limited.
- 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.
- Greater ease of use—because it limits the options to choose from by only displaying the essential choices.
Format Check – this 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 – this kind of 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 they won’t be able to proceed to the next step, nor will they be able to save any other data which they have entered.