Today almost every website contains certain web forms in its structure, such as a simple feedback form or a certain sign-up form.
To ensure that the information sent by a user will be finally accepted and processed, you should perform special testing, to check if every form used on a portal has been properly filled. Such actions are based on validation.
All correct data can be easily sent to a server and saved in a DB.
If a user makes a certain error on a website (while completing a form), such information can’t be sent to a DB.
What is validation?
Validation is a certain confirmation based on the evidence that the established requirements aimed at certain usage or management have been met.Validation should always answer the question: “Do we develop a good product?”
Validation is very important for executing web testing, aimed at big data processing from the user side.
In the technical aspect, we can distinguish 2 types of software component validation:
- Validation on a server side;
- Validation on a client side.
Validation on a server side
It’s executed on a server side when information has been sent by a client. It’s not very convenient, in comparison with validation on a web browser side since a user can’t get feedback until all fields of a form have been sent to a server.
The only exception is Ajax validation – Ajax calls can be checked on a server when they are directly entered and when there is instant feedback (for example, validating the availability of a new user’s login while registering a new account).
Validation on a server side is, in some way, the “last shield” (line of defense) that protect from incorrect data entry or even malicious hacker attacks.
Such a method of validation is absolutely safe since it will always work even if JS is switched off in a browser and hackers can’t easily bypass it.
Today all popular frameworks use the functions of data validation.
The main disadvantage of such validation is that it’s completely oriented on JS usage. If a user decides to switch off JS on a website, he/she will be able to easily bypass server validation.It’s the reason why validation should always be executed both on a client side and a server side.
The combination of validation on a client side and on a server side has several advantages: instant response, better validation, and better client experience (in other words, UX).
Validation on a client side
It’s actually instant validation, performed directly in a browser, in other words, until the data has been sent to a server. Such validation is much more efficient than the validation on a server side since the possibility to control data entry on a client side allows getting an instant response.
There are 2 ways to perform such validation:
- On the basis of JS – it’s a completely flexible method that can be adjusted to every developer;
- On the basis of HTML – it’s more efficient but is limited to the configuration, in comparison with JS.
Initially, all validation rules are strict, in other words, a client should correct his/her errors himself/herself, till the data will have been sent to a server.
Strict validations ensure a high quality of information with the lowest number of errors (typos, misspellings, etc.).
The problem of strict validation lies in blocking client work with web forms. It’s its primary aim but if all validation rules aren’t completely qualitative, a client will finally be able to easily work with forms, not needing to correct the already completed forms and data entry fields.
For example, users that have unusual emails can be blocked by some email validation tools, so that a user won’t be able to complete an order in an online shop. In such cases, a user can sometimes create a new mail account to register on this website.
If we don’t use all strict validation policies, we can apply moderate validation that sometimes can be easily ignored by users. This means that if data that has been entered doesn’t meet technical requirements, a user will see a message about this. But he/she will be able to continue using a website by saving the data that have been already sent to a server.
Every validation should warn a user that he/she should always check his/her data and his/her interaction with a website shouldn’t be interrupted and be disturbed.
A user should be informed about some potential consequences of incorrect data entry and also, he/she should be given the possibility of further interaction with a website at his/her own risk.