Chapter 6. Data Validation

In this chapter, we will cover the following recipes:

  • Validating text by length
  • Validating numbers by range
  • Using the built-in pattern validation
  • Advanced use of built-in constraints and custom validations
  • Calculating password strength
  • Validating US zip codes
  • Using asynchronous server-side validation
  • Combining client-side and server-side validation

Introduction

Forms usually expect the user to behave in a certain way and to insert data as requested. This is where data validations come in. Server-side validation is always a must to do and form validation at the client side should be considered.

Validation makes the application user-friendly, saves time and bandwidth. Client-side and server-side validation complement each other and ...

Get HTML5 Data and Services Cookbook 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.