Note Even if you use client-side validation, validation is always also performed in server code.
When you restrict the values that users can enter in forms, you reduce the chance that someone can enter a value that can compromise the security of your site.
Users get immediate feedback, which is convenient for them.
Client-based validation can also reduce the number of times that the user has to submit the form to correct multiple errors.
To see how validation works, run this page and deliberately make mistakes.
For example, here's what the page looks like if you forget to enter a course name, if you enter an, and if you enter an invalid date: By default, user input is validated after users submit the page — that is, the validation is performed in server code.
For example, you don't want to process a form that's missing critical information.