Combining client-side and server-side validation

When dealing with real web forms we usually need to do various kinds of validation on multiple fields. Some fields may only need checks that can be performed at the client side, while some might also require server-side validation.

In this recipe, we're going to design and implement our own validation plugin that supports asynchronous validation. It will work similarly to jQuery Validate. We're also going to implement some basic validation methods such as required, minLength, and remote.

We're going to use these methods on a simple user registration form, which will be blocked from submission until the user enters valid data in all fields.

Getting ready

The first step in our design process is to design ...

Get HTML5 Data and Services Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.