Skip to content Skip to sidebar Skip to footer

Detect Cancelled Form Post With Javascript

I'm working on a web project that has a lot of abstraction - lots of code is squirreled away in view templates, internal company javascript libraries, etc. I have been asked to 'h

Solution 1:

You may use a wrapper on the validation function:

var oldHandler = form.prop("onsubmit");
form.removeProp("onsubmit").submit(function(e) {
  var result = oldHandler.call(this, e);
  if (result == false) {
    // reset your button
  }
  return result;
});

Post a Comment for "Detect Cancelled Form Post With Javascript"