diff options
author | Mark Wells <mark@freeside.biz> | 2015-07-10 16:38:28 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-07-10 16:38:28 -0700 |
commit | 0ed195595b5c7ea404c8848d9d1881ada4214489 (patch) | |
tree | 6d6f3fe6e980cd123ff7a648d27fb9eb6b16ab13 /rt/share/static/js/forms.js | |
parent | af05c3dda381122e0a45f72dbc0b4e9492f13fe7 (diff) | |
parent | df4a68099abfa067014f36f92874fccefdea662e (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
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); + } + }); +}); |