Validating user inputs
Validation ensures your data security and consistency and helps your application to operate properly. Validation is a wide topic, and there are some common levels of validation, as outlined here:
- Client-side validation is used to pre-validate the user input before sending data to the server. It is important for the user experience (UX), and you should always implement it wherever possible. However, it cannot guarantee security—even an inexperienced hacker can bypass it. For example, checking whether a required textbox field is empty is a type of client-side validation. We will cover client-side validation in Part 4, User Interface and API Development.
- Server-side validation is performed by the server to prevent incomplete, badly formatted, or malicious requests. It provides some level of security for your application and is generally performed when you first touch the data sent by the client. For example, checking a required input field is...