Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added cfg.noprompt - the class name which when applied to the <form> …

…will "turn off" savoir. this is useful if some elements (for example a link or a cancel button) must be allowed to leave the page without having the changed form data submitted. those element can for example use $(this).closest("form").addClass('noprompt') in their click-event to set the class and thus turn off formSavior.
  • Loading branch information...
commit ecb2863d50d7383742b85364e9407df0fbefbe17 1 parent bc39d2c
heldchen authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 jquery.formSavior.js
View
5 jquery.formSavior.js
@@ -3,7 +3,8 @@
return this.each(function() {
var cfg = {
- 'msg' : 'There are unsaved changes on this form'
+ 'msg' : 'There are unsaved changes on this form',
+ 'noprompt' : 'noprompt
};
if ( options ) {
@@ -27,7 +28,7 @@
function savePrompt() {
current = $form.serialize();
- if(current != originals && showalert === true) {
+ if(current != originals && showalert === true && !$form.hasClass(cfg.noprompt)) {
return cfg.msg;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.