Chapter 2. Validation of Forms

Form validation has always been tricky and painful for developers since the Web was born. Before HTML5, it was a nightmare for developers to write lines of code for validating forms to get the desired information from the user.

In this chapter, we will cover the following topics:

  • Validation, their benefits, and their types
  • HTML5 <input> and attributes used in validations
  • The difference between JavaScript and HTML5 validations with an example
  • Validation constraints and supported APIs (Application Programming interface)
  • Default error messages displayed by the browser

Form validation

Validation of a form is a series of checks and notifications that guides a user as to what is required as an input while submitting information ...

Get Mastering HTML5 Forms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.