Skip to content
jmarnold edited this page Jul 7, 2012 · 1 revision

Overview

jquery.continuations.forms.js provides a new method on the jQuery object called correlatedSubmit and is designed to work in conjunction with jQuery.form.js and jquery.continuations.js.

Exposing the form for processing

The correlatedSubmit method proxies the ajaxSubmit method and provides custom properties for use in the continuation processing pipeline.

Like the ajaxSubmit method, the correlatedSubmit method works on a form element. When the ajax request has completed, the jquery object representing the form is appended to the continuation via the form property. This makes the form itself available for all policies in the processing pipeline.

Syntax

The method behaves like ajaxSubmit and can accept the basic ajax options. The following are also available:

  • continuationSuccess
  • continuationError

The continuation callbacks behave just like they would on a standard $.ajax call.

Passing custom properties

Any additional properties passed to correlatedSubmit will be used as the options property on the continuation. For example:

$('#theForm').correlatedSubmit({ myCustomProperty: '1234' })

In the above example, continuation.options.myCustomProperty would be available to all policies in the pipeline.

Why?

The initial use case for this was for the creation of fubuvalidation.js (another Fubu project) to conventionally display form validation. However, the power of conventionally correlating a request to its originating form can extend much further than validation.