Form Validations
This article is only a theory part.
Validations are done with the help of JavaScript and its libraries. So here we
are learn about validations theoretically.
Form validations in the html are very
important while collecting the data from user. When user enter wrong details or
to reduce the spam from the users we use form validations. Firstly we give
suggestions for users to enter details properly. But it gives an idea for users
but not have any guarantee for reduce spam. To reduce this we are using form
validations.
There are two types of form validations
- . Client side validation
- Server side validation
Client
side validation: - In the browser what we seen
is front end and the validations occur in this part is called client side
validation. The browser itself check the details and send it to the server is
called client side validation.
Server
side validation: - Server check everything and
verify whether the user data is valid or not is called server side validation.
Here we have a question if the browser
itself validate data then why we are using server side validation?
There are mainly two reasons.
1.
Reduce the burden on server we
are using client side validation
2.
To remove the duplicates in we
are using Server side validation
In previous article we are discussing about
“””how website or application works”””. In that article we are discussing about
browser, server and database. These three sections used to create a web
application. Here both three sections have validations. This avoids unwanted
data.
Why we are using Validation?
Validations are used to avoid the invalid
data from the user. For example we are going to a shopping mall there are some
security checks are used like metal detectors to avoid unwanted equipment’s and
also we have cctv cameras to avoid pickpockets.. And also different types to
avoid cheating etc.
Here metal detectors are the primary
validation and CCTV cameras works as secondary validation to avoid cheating
etc. In coding also we have these two types of validations to avoid spam data.
Client side validators are the primary
validation to avoid spam data from user. But sometimes the data available in
the database will be repeated multiple times. Client side validation doesn’t
stop this matched data. Because HTML don’t know if the data available in the
database or not. Then we are used this server side validation. Here Server side
validation is secondary validation.
The basic information of Client side validation and Server side validation
The above image shows how validation works.
Image show basic idea how a validation works.. In future articles we discuss
how to apply validation to our forms.