What is the difference between client side and server side validation?

Posted on

Client side validation means the validation of a piece of data is executed on the client’s machine, while the server side validation means that the data is sent to server side first, then the validation is carried out.
This would need some examples to put the terms in context. Client side validation, for most of the software that runs on a PC without network or internet connection, if there is any validation, there is no distinguish of “client” or “server”, because they are the same (the PC).
But for internet (not limited to this, it could be network, 2 iPads) connections for example, let’s say the web page ask you to provide a password entry. The validation of the password entry may occur on both client side and server side. The client side (your internet browser on your PC) validation may use JavaScript to check the length of the password string (not the content of the string) to see if it exceeds a certain length (e.g., minimum of 6 characters). If yes, then the data is sent to server side to be validated (the entered value against the registered value). That server maybe at the other side of the globe.

Client side validation will be written using client side scripts like JavaScript or VB Script. Whereas the server side validation will be written using your server side programming language such as PHP, JSP, PERL or anything you are using. Always go with Server side validation, it will be very helpfull, if your client side script has any error or the script is disabled in client’s browser.

When you submit your e-mail thorough a web form, let say:

If you use client-side validation (Javascript) – the browser (Firefox, IE, Chrome…) will validate the e-mail without having to send it to the server.
Which means, no Internet connection needed, it’s fast since you don’t have to wait for the page to be refreshed to see the validiation..

With Server side validation, everything is the opposite. I would say client side validation is safer.

But, if someone has disabled javascript in their browser then that would mean, their web browser is unable to validiate the form so i guess like the above person indicated.. server side validation would be safer, because they can not turn off server validation in their browser.

Advertisements

One thought on “What is the difference between client side and server side validation?

    Web languages | in4om said:
    August 30, 2013 at 8:05 pm

    […] What is the difference between client side and server side validation? (carrierride.wordpress.com) […]

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s