Disable submit button after first click to avoid double submits

This commit is contained in:
2019-02-20 15:05:35 +01:00
parent 0e3fca6835
commit cdb78a10bd
+12 -8
View File
@@ -10103,7 +10103,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("var last_key = 0;\n\n");
rsprintf("var in_asend = false;\n\n");
rsprintf("function chkform()\n");
rsprintf("function chkform(button)\n");
rsprintf("{\n");
rsprintf(" if (last_key == 13) {\n");
@@ -10266,7 +10266,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf(" if (autoSaveTimer != null)\n");
rsprintf(" clearTimeout(autoSaveTimer);\n");
rsprintf(" button.disabled = true;\n");
rsprintf(" button.value = \"%s...\";\n", loc("Please wait"));
rsprintf(" submitted = true;\n");
rsprintf(" document.getElementById(\"form1\").elements['cmd'][0].value = \"%s\";\n", loc("Submit"));
rsprintf(" document.getElementById(\"form1\").submit();\n");
rsprintf(" return true;\n");
rsprintf("}\n\n");
@@ -10575,7 +10579,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf(">\n");
show_top_text(lbs);
rsprintf("<form name=form1 method=\"POST\" action=\"./\" ");
rsprintf("<form name=\"form1\" id=\"form1\" method=\"POST\" action=\"./\" ");
rsprintf("enctype=\"multipart/form-data\">\n");
/*---- add password in case cookie expires during edit ----*/
@@ -10613,7 +10617,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
/* default cmd */
rsprintf("<input type=hidden name=cmd value=\"%s\">\n", loc("Update"));
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return chkform();\">\n",
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return chkform(this);\">\n",
loc("Submit"));
if (!getcfg(lbs->name, "Save drafts", str, sizeof(str)) || atoi(str) == 1)
@@ -12148,7 +12152,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
/*---- menu buttons again ----*/
rsprintf("<tr><td class=\"menuframe\"><span class=\"menu1\">\n");
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return chkform();\">\n",
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return chkform(this);\">\n",
loc("Submit"));
if (!getcfg(lbs->name, "Save drafts", str, sizeof(str)) || atoi(str) == 1)
@@ -14356,7 +14360,7 @@ void show_new_user_page(LOGBOOK * lbs, char *user)
show_html_header(lbs, TRUE, loc("ELOG new user"), TRUE, FALSE, NULL, FALSE, 0);
rsprintf("<body><center><br><br>\n");
show_top_text(lbs);
rsprintf("<form name=form1 method=\"GET\" action=\".\">\n\n");
rsprintf("<form name=\"form1\" id=\"form1\" method=\"GET\" action=\".\">\n\n");
/*---- title ----*/
@@ -26355,7 +26359,7 @@ void show_login_page(LOGBOOK * lbs, char *redir, int fail)
/* set focus on name field */
rsprintf("<body OnLoad=\"document.form1.uname.focus();\">\n");
rsprintf("<form name=form1 method=\"POST\" action=\"./\" enctype=\"multipart/form-data\">\n\n");
rsprintf("<form name=\"form1\" id=\"form1\" method=\"POST\" action=\"./\" enctype=\"multipart/form-data\">\n\n");
/* define hidden fields for current destination */
strlcpy(str, redir, sizeof(str));
@@ -27006,7 +27010,7 @@ void show_calendar(LOGBOOK * lbs)
strcpy(index, "1");
show_html_header(lbs, FALSE, loc("Calendar"), TRUE, FALSE, NULL, FALSE, 0);
rsprintf("<body class=\"calwindow\"><form name=form1 method=\"GET\" action=\"cal.html\">\n");
rsprintf("<body class=\"calwindow\"><form name=\"form1\" method=\"GET\" action=\"cal.html\">\n");
rsprintf("<input type=hidden name=\"i\" value=\"%s\">\n", index);
rsprintf("<input type=hidden name=\"y\" value=\"%d\">\n", cur_year);
@@ -27109,7 +27113,7 @@ void show_uploader(LOGBOOK * lbs)
char str[256];
show_html_header(lbs, FALSE, loc("Upload image"), TRUE, FALSE, NULL, FALSE, 0);
rsprintf("<body class=\"uploadwindow\"><form name=form1 method=\"POST\" action=\".\" ");
rsprintf("<body class=\"uploadwindow\"><form name=\"form1\" method=\"POST\" action=\".\" ");
rsprintf("enctype=\"multipart/form-data\">\n");
rsprintf("<input type=hidden name=\"jcmd\" value=\"JUpload\">\n");