Skip to content

Instantly share code, notes, and snippets.

@joshuaclayton
Created February 2, 2009 14:26
Show Gist options
  • Save joshuaclayton/56924 to your computer and use it in GitHub Desktop.
Save joshuaclayton/56924 to your computer and use it in GitHub Desktop.
// With Rails remote form helpers, the AJAX call is bound on the onsubmit attribute.
// Submitting that form via a framework (Prototype, jQuery, etc.) doesn't use the onsubmit
// attribute's Javascript because it was never explicitly bound. Is this really the only
// way to have a framework trigger the code nestled within the onsubmit attr?
$(document).ready(function() {
$("form").each(function() {
var self = $(this);
self.submit(function() {
new Function(self.attr("onsubmit"))();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment