[OFBiz] SVN: r6941 - in trunk/framework: images/webapp/images widget/src/org/ofbiz/widget/html
jonesde@svn.ofbiz.org
jonesde at svn.ofbiz.org
Tue Mar 7 17:53:41 CST 2006
Author: jonesde
Date: 2006-03-07 17:53:36 -0600 (Tue, 07 Mar 2006)
New Revision: 6941
Modified:
trunk/framework/images/webapp/images/selectall.js
trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
Log:
Some changes to disable buttons after they are clicked using java script; based on a patch from Leon Torres, but put in a different file (the selectall.js file has been the collecting place for misc little methods like this, so putting there; it should eventually be renamed); based on the JS stuff in the checkoutreview.ftl page in ecommerce; Jira #OFBIZ-767
Modified: trunk/framework/images/webapp/images/selectall.js
===================================================================
--- trunk/framework/images/webapp/images/selectall.js 2006-03-07 23:30:28 UTC (rev 6940)
+++ trunk/framework/images/webapp/images/selectall.js 2006-03-07 23:53:36 UTC (rev 6941)
@@ -184,3 +184,9 @@
return false;
}
}
+
+// prevents doubleposts for <submit> inputs of type "button" or "image"
+function submitFormDisableButton(button) {
+ button.disabled = true;
+ button.form.submit();
+}
Modified: trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java 2006-03-07 23:30:28 UTC (rev 6940)
+++ trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java 2006-03-07 23:53:36 UTC (rev 6941)
@@ -681,6 +681,7 @@
public void renderSubmitField(StringBuffer buffer, Map context, SubmitField submitField) {
ModelFormField modelFormField = submitField.getModelFormField();
ModelForm modelForm = modelFormField.getModelForm();
+ String singleClickAction = " onClick=\"javascript:submitFormDisableButton(this)\" ";
if ("text-link".equals(submitField.getButtonType())) {
buffer.append("<a");
@@ -724,6 +725,8 @@
this.appendContentUrl(buffer, submitField.getImageLocation());
buffer.append('"');
+ buffer.append(singleClickAction);
+
buffer.append("/>");
} else {
// default to "button"
@@ -748,6 +751,9 @@
buffer.append('"');
}
+ // add single click JS onclick
+ buffer.append(singleClickAction);
+
buffer.append("/>");
}
More information about the Svn
mailing list