[Rt-commit] rt branch, 4.2/disable-submit-buttons-on-submit, created. rt-4.0.5-282-g036f109
Ruslan Zakirov
ruz at bestpractical.com
Thu Mar 8 16:20:57 EST 2012
The branch, 4.2/disable-submit-buttons-on-submit has been created
at 036f1090ba5900ae1c91c9b9d2e50c6750391aeb (commit)
- Log -----------------------------------------------------------------
commit 036f1090ba5900ae1c91c9b9d2e50c6750391aeb
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Mar 9 01:17:32 2012 +0400
prevent double form submit by disabling buttons
Users have time to double click submit buttons and
submit forms twice. This change disables submit buttons
when forms is submitted. However, input is disabled
a little bit earlier and browser wouldn't send its
name/value pair to the server, so we add a hidden
input.
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 2e8ef50..ea24b6b 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -868,6 +868,7 @@ Set(@JSFiles, qw/
supersubs.js
jquery.supposition.js
history-folding.js
+ forms.js
late.js
/);
diff --git a/share/html/NoAuth/js/forms.js b/share/html/NoAuth/js/forms.js
new file mode 100644
index 0000000..9e9e14d
--- /dev/null
+++ b/share/html/NoAuth/js/forms.js
@@ -0,0 +1,15 @@
+jQuery(function() {
+ jQuery('form').submit(function() {
+ jQuery(this).find('input[type="submit"]').attr('disabled','disabled');
+ return true;
+ })
+});
+jQuery(function() {
+ jQuery('input[type="submit"]').click(function() {
+ var $this = jQuery(this);
+ var name = $this.attr('name');
+ if (!name) { return true; }
+ $this.append('<input type="hidden" name="'+ name +'" value="1" />');
+ return true;
+ })
+});
\ No newline at end of file
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list