Our Ajax Conventions–Validation

As I mentioned in my previous posts, I’m doing a write up of our AJAX conventions and how they’re paying off for us.

In this series of posts, I’m going to cover a few topics:

  1. The AjaxContinuation
  2. Clientside Continuations
  3. Request Correlation
  4. Validation (this post)

Correlation by form

Last time I discussed how to correlate your requests with jquery.continuations. One of the gems that ships with continuations is the $.fn.correlatedSubmit method for forms. This method uses the id of the form (a quick unique check is performed) as the correlation id.



This isn’t an exhaustive explanation of the new fubuvalidation.js bits. I’ll flush this out in the docs.

Not another one…

First off: no, it’s not “another js validation library”. fubuvalidation makes use of the continuation contract but makes no effort to perform client-side validation. Instead, it aims to bridge that gap between client-side and server-side validation.

The handler

I’m only explaining this because I know I’ll get asked about it. fubuvalidation.js ships with a default handler. This handler renders a nice validation summary, highlights fields, and provides a little bit of interactivity. And of course, the handler is exposed through $.fubuvalidation.defaultHandler so you can override any of the functions that you don’t like. And like the rest of the Fubu projects, you can completely override our defaults if you don’t like them.

Back to my point…

fubuvalidation.js relies on the continuation that is returned by any of your ajax calls via jquery.continuations. Here’s how we plug into the pipeline:

Just another example of what you can do once you get your conventions defined.

Our Ajax Conventions–Request Correlation