The Required
validation was straightforward, but email validation is a little bit different; each developer would adopt different approaches for the validation. The emergence of jQuery validation provided consistent behavior for most of the validations. Later, the standard set by the HTML5 team is not adopted widely by all browsers and development teams.
Let's explore the EmailAddress
built-in validation which would allow us to validate whether the value is a valid email or not. The following steps will help us in understanding how validation works:
The data annotation was already discussed; we will be using the
EmailAddress
attribute in this section.The MVC engine scaffolding part, the validations, populating model state errors, and displaying errors on the screen, almost the entire process, would be the same for the remaining of the chapters. We can additionally cover how the validation is performed in each section as each of the in-built validation follow different...