* form: Block the submit button to not allow Chrome/Edge to submit multiple times in case of multiple clicks on slow server
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3806 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
10
form.php
10
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 .= " </div>\n";
|
||||
$res .= " </div>\n";
|
||||
|
||||
Reference in New Issue
Block a user