A place to declare site-wide XHR callbacks and StatusHandlers. These callbacks, if present, are invoked immediately after (and independant of) a FormRule's local counterpart.
Note that even though these are registered 'globally', they are still executed within the context of the working FormHelperRequest.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
xhrReady |
FormRule.xhrReady |
<optional> |
|
xhrBeforeSend |
FormRule.xhrBeforeSend |
<optional> |
|
xhrSuccess |
FormRule.xhrSuccess |
<optional> |
|
xhrError |
FormRule.xhrError |
<optional> |
|
xhrComplete |
FormRule.xhrComplete |
<optional> |
|
onComplete |
FormRule.onComplete |
<optional> |
|
status |
Object.<String, FormRule.StatusHandler> |
<optional> |
- Source:
Examples
formHelper.always.xhrSuccess = function() {
if (this.status !== 'SUCCESS') {
// A form submission was not successful!
// Track an event perhaps?
}
};
formHelper.always = {
xhrError: function() {
// XHR error - what to do?
},
status: {
WEBSITE_BROKEN: '/' // Redirect home
}
};