diff options
author | Philip Häusler <msquare@notrademark.de> | 2014-12-06 21:39:59 +0100 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2014-12-06 21:39:59 +0100 |
commit | 30c8b48996c3e898fdeaad48cb5ff1c8c9431272 (patch) | |
tree | 4de333ca87c0637facb206bd165c1273de8e7953 /public | |
parent | 40d83367bbf70f9ca609c21d7a76f99f0141a569 (diff) |
prevent forms from being double-submitted
Diffstat (limited to 'public')
-rw-r--r-- | public/js/forms.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/public/js/forms.js b/public/js/forms.js index 630d8c25..a8c7f6ce 100644 --- a/public/js/forms.js +++ b/public/js/forms.js @@ -1,8 +1,8 @@ function check_all(id) { var obj = document.getElementById(id); var boxes = obj.getElementsByTagName("input"); - for(var i = 0; i < boxes.length; i++) { - if(boxes[i].type == "checkbox" && !boxes[i].disabled) + for ( var i = 0; i < boxes.length; i++) { + if (boxes[i].type == "checkbox" && !boxes[i].disabled) boxes[i].checked = true; } } @@ -10,8 +10,15 @@ function check_all(id) { function uncheck_all(id) { var obj = document.getElementById(id); var boxes = obj.getElementsByTagName("input"); - for(var i = 0; i < boxes.length; i++) { - if(boxes[i].type == "checkbox") + for ( var i = 0; i < boxes.length; i++) { + if (boxes[i].type == "checkbox") boxes[i].checked = false; } } + +$(function() { + $('form').submit(function(ev) { + $('input[type="submit"]').prop("readonly", true).addClass("disabled"); + return true; + }); +}); |