prevent forms from being double-submitted

This commit is contained in:
Philip Häusler 2014-12-06 21:39:59 +01:00
parent 40d83367bb
commit 30c8b48996
1 changed files with 11 additions and 4 deletions

View File

@ -1,8 +1,8 @@
function check_all(id) { function check_all(id) {
var obj = document.getElementById(id); var obj = document.getElementById(id);
var boxes = obj.getElementsByTagName("input"); var boxes = obj.getElementsByTagName("input");
for(var i = 0; i < boxes.length; i++) { for ( var i = 0; i < boxes.length; i++) {
if(boxes[i].type == "checkbox" && !boxes[i].disabled) if (boxes[i].type == "checkbox" && !boxes[i].disabled)
boxes[i].checked = true; boxes[i].checked = true;
} }
} }
@ -10,8 +10,15 @@ function check_all(id) {
function uncheck_all(id) { function uncheck_all(id) {
var obj = document.getElementById(id); var obj = document.getElementById(id);
var boxes = obj.getElementsByTagName("input"); var boxes = obj.getElementsByTagName("input");
for(var i = 0; i < boxes.length; i++) { for ( var i = 0; i < boxes.length; i++) {
if(boxes[i].type == "checkbox") if (boxes[i].type == "checkbox")
boxes[i].checked = false; boxes[i].checked = false;
} }
} }
$(function() {
$('form').submit(function(ev) {
$('input[type="submit"]').prop("readonly", true).addClass("disabled");
return true;
});
});