diff options
author | Mark Wells <mark@freeside.biz> | 2015-07-10 18:15:08 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-07-10 18:15:08 -0700 |
commit | 88bf5db0cca989c51237c661a13078eef08b3674 (patch) | |
tree | 0a84e1b5e7fd239f57fab678bf40c5311b0064a0 /rt/share/static/js/forms.js | |
parent | 9c15ffe3a5ee987e30e10c6a0ad1b5bf0b2a12e3 (diff) | |
parent | e7eb845db1afab1cbdbc34ff9c387c5ac554659e (diff) |
Merge branch 'FREESIDE_4_BRANCH' of git.freeside.biz:/home/git/freeside into 4.x
Diffstat (limited to 'rt/share/static/js/forms.js')
-rw-r--r-- | rt/share/static/js/forms.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/rt/share/static/js/forms.js b/rt/share/static/js/forms.js new file mode 100644 index 000000000..3c6f9b93d --- /dev/null +++ b/rt/share/static/js/forms.js @@ -0,0 +1,18 @@ +jQuery(function() { + // reset form submit info when user goes backward or forward for Safari + // other browsers don't need this trick and they can work directly. + if ( window.addEventListener ) { + window.addEventListener("popstate", function(e) { + jQuery('form').data('submitted', false); + }); + } + + jQuery('form').submit(function(e) { + var form = jQuery(this); + if (form.data('submitted') === true) { + e.preventDefault(); + } else { + form.data('submitted', true); + } + }); +}); |