-
Notifications
You must be signed in to change notification settings - Fork 4
correlatedSubmit
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.
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.
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.
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.
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.