Created
August 7, 2013 15:52
-
-
Save jmarnold/6175375 to your computer and use it in GitHub Desktop.
Validation hooks for Matt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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