Which Input Validation to choose : Client Side or Server Side ?

Pankaj Kumar
2 min readApr 9, 2021

While developing any type of application, One of the major task is to validate all the input made by the end user.

Validation is a process of testing to ensure that the user has entered the expected data/information with required formatting through the form available.

Why Input Validation is needed?

  • SQL injection can corrupt entire database.
  • Cross-site scripting may allow an attacker to post any data on server.
  • Header injection attacks can be used to perform malicious task from the server.

Now validation can be made at 2 places:

  1. Client Side Validation
  2. Server Side Validation

Client Side Validation

Client side validation occurs at browser end before data is submitted to the server. It is very popular and quick where user gets instant error message/ feedback while entering information. Client side validation is performed using JavaScript code and using HTML5 form validation features.

Server Side Validation

Server side validation is performed at server end when form data is submitted by user from browser or any other application. Server side validation if performed before performing any logical task/ saving in database. Server side validation can be performed in the languages like PHP, Java, .NET, NodeJS(JS server side framework) etc.,

Why server-side validation is necessary?

  • Client side validation is not full proof and it can be subverted.
  • Client side validation can be completely bypassed by turning off JavaScript.

Conclusion

User input validation is very important part of any type of application development. Client side and Server side both are highly recommended to use to make an application user friendly and robust.

Find much more about JavaScript libraries/frameworks at JsonWorld

Click here to Join live Classed led by IT Professionals of Tech Giants like TCS, IBM, Accenture, Infosys, etc.

--

--

Pankaj Kumar

JavaScript Developer | Blogger — Expert in NodeJS, Firebase, Angular, React(Instructor at edhint.com)