diff --git a/form.php b/form.php index 468ab00..a74ddce 100644 --- a/form.php +++ b/form.php @@ -838,6 +838,16 @@ class formfield $res .= " class='form-control btn-primary'"; if (isset ($this->hidden) && $this->hidden !== FALSE) $res .= " style='display:none'"; + // Block the submit button 10s. The user can not double click on it and + // submit two times the POST to the server + // Re-enable after 15s, if there is a problem with the server + // This code is needed by Chrome and Edge which allow multiple submission of + // a form + $res .= " onclick='submit=this ; "; + $res .= "submit.setAttribute(\"disabled\", \"disabled\");"; + $res .= " setTimeout(function() {"; + $res .= " submit.removeAttribute(\"disabled\"); }, 15000);"; + $res .= "'"; $res .= "/>\n"; $res .= " \n"; $res .= " \n";