Skip to content

Instantly share code, notes, and snippets.

@danielgreen
Last active December 18, 2015 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielgreen/5823028 to your computer and use it in GitHub Desktop.
Save danielgreen/5823028 to your computer and use it in GitHub Desktop.
An unobtrusive way to block the page on form submission. Requires jQuery Validation to be active on the form (either directly or via unobtrusive validation), and the submithandlerfix to be applied (https://gist.github.com/danielgreen/5669244). If jQuery Validation is not active on the form then we need another solution e.g. just bind to onsubmit
$("form[data-block-page-on-submit]").each(function () {
$(this).validate().settings.submitHandler = function () {
window.BlockPage();
return true;
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment