Skip to content

Instantly share code, notes, and snippets.

@jmarnold
Created August 7, 2013 15:52
Show Gist options
  • Save jmarnold/6175375 to your computer and use it in GitHub Desktop.
Save jmarnold/6175375 to your computer and use it in GitHub Desktop.
Validation hooks for Matt
// This is missing but easy to add
$(form).bind('validation:onsubmit', function(e, promise) {
promise.done(function(notification) {
// query the notification itself
notification.isValid()
// use the continuation
notification.toContinuation();
});
});
// This is already there (one minor fix on the serverside to push down the origin)
$(form).bind('validation:processed', function(e, continuation) {
if(continuation.isFromServer()) {
continuation.form.enable();
}
});
// Or we could extend the clientside to do (continuations doesn't expose promises but *should*):
$(form).bind('validation:ajax', function(e, promise) {
promise.done(function(continuation) {
continuation.form.enable();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment