Skip to content

Instantly share code, notes, and snippets.

@derencius
Created July 22, 2010 20:03
Show Gist options
  • Select an option

  • Save derencius/486501 to your computer and use it in GitHub Desktop.

Select an option

Save derencius/486501 to your computer and use it in GitHub Desktop.
Remote.WithJsValidation = $.klass(Remote.Base, {
initialize: function() {
$(this.element).validate();
},
onsubmit: function(event) {
if ($(this.element).valid()) {
return true;
} else {
event.preventDefault();
return false;
}
}
});
$("form.validation").attach(Remote.WithJsValidation);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment