Skip to content

Instantly share code, notes, and snippets.

@bkono
Created September 21, 2011 15:36
Show Gist options
  • Save bkono/1232401 to your computer and use it in GitHub Desktop.
Save bkono/1232401 to your computer and use it in GitHub Desktop.
Eager js validation with asp.net mvc 3
<script type="text/javascript">
$(document).ready(function () {
var settngs = $.data($('form')[0], 'validator').settings;
settngs.onfocusout = function (element) { $(element).valid(); };
});
</script>
options: { // options structure passed to jQuery Validate's validate() method
errorClass: "input-validation-error",
errorElement: "span",
errorPlacement: $.proxy(onError, form),
invalidHandler: $.proxy(onErrors, form),
messages: {},
rules: {},
success: $.proxy(onSuccess, form),
onfocusout: function (element) { $(element).valid(); }
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment