Client-Side Validation
In this lesson, you will learn how to add and configure client-side validation that gives immediate feedback to the user.
The purpose of user input on the server-side is to protect the application from wrong inputs and malicious users. It doesn’t give immediate feedback to the user, since errors are shown only after the form has been submitted and the server returns its response.
A JavaScript-based detection of at least property-level errors improves the user experience as it immediately drives the user to correct input. ASP.NET Core MVC has built-in facilities for adding client-side validation for all its built-in validation attributes.
jquery.validate.js and unobtrusive validation
ASP.NET Core MVC client-side validation is based on the jquery.validate.js
library, and on a JavaScript library that interfaces jquery.validate.js
with ASP.NET Core. This overall JavaScript validation is called unobtrusive since validation rules associated with each input field are not inserted in the page as JavaScript snippets, but are defined through data-
attributes added to the input tags while they are rendered.
More specifically, client-side validation rules ...