Author: jonesde
Date: Wed Apr 4 15:16:59 2007 New Revision: 525629 URL: http://svn.apache.org/viewvc?view=rev&rev=525629 Log: Changed submit disable code to disable for 2 seconds then re-enable; had to do some tricky stuff with the cross-page timer, but works in Firefox and IE Modified: ofbiz/trunk/framework/images/webapp/images/maincss.css ofbiz/trunk/framework/images/webapp/images/selectall.js ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Modified: ofbiz/trunk/framework/images/webapp/images/maincss.css URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/maincss.css?view=diff&rev=525629&r1=525628&r2=525629 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/maincss.css (original) +++ ofbiz/trunk/framework/images/webapp/images/maincss.css Wed Apr 4 15:16:59 2007 @@ -58,6 +58,12 @@ text-decoration: underline; } +.disabled { +background-color: #cccccc; +color: #333366; +text-decoration: none; +} + body, textarea, input, select { font-family: Verdana, Arial, Helvetica, sans-serif; } @@ -162,11 +168,17 @@ padding: 0.1em 0.2em 0.1em 0.2em; } -.smallSubmit:hover, .smallSubmit:active { +.smallSubmit:hover { color: #ff0000; text-decoration: none; } +.smallSubmit:active { +background-color: #cccccc; +color: #333366; +text-decoration: none; +} + .endcolumns { /* deprecated - use .clear */ clear: both; @@ -1847,6 +1859,12 @@ .basic-form table tr td .smallSubmit:hover, .basic-form table tr td .smallSubmit:active { color: #ff0000; +text-decoration: none; +} + +.basic-form table tr td .disabled { +background-color: #cccccc; +color: #333366; text-decoration: none; } Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?view=diff&rev=525629&r1=525628&r2=525629 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original) +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Wed Apr 4 15:16:59 2007 @@ -184,10 +184,36 @@ } } +function submitFormDisableSubmits(form) { + for (var i=0;i<form.length;i++) { + var formel = form.elements[i]; + if (formel.type == "submit") { + submitFormDisableButton(formel); + var formName = form.name; + var formelName = formel.name; + var timeoutString = "submitFormEnableButtonByName('" + formName + "', '" + formelName + "')"; + var t = setTimeout(timeoutString, 1500); + } + } +} + // prevents doubleposts for <submit> inputs of type "button" or "image" function submitFormDisableButton(button) { if (button.form.action != null && button.form.action.length > 0) { button.disabled = true; } - button.form.submit(); + button.className = button.className + " disabled"; + button.value = button.value + "*"; } + +function submitFormEnableButtonByName(formName, buttonName) { + // alert("formName=" + formName + " buttonName=" + buttonName); + var form = document[formName]; + var button = form.elements[buttonName]; + submitFormEnableButton(button); +} +function submitFormEnableButton(button) { + button.disabled = false; + button.className = button.className.substring(0, button.className.length - " disabled".length); + button.value = button.value.substring(0, button.value.length - 1); +} Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?view=diff&rev=525629&r1=525628&r2=525629 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr 4 15:16:59 2007 @@ -848,7 +848,7 @@ buffer.append(action); buffer.append('"'); } else { - buffer.append(singleClickAction); + // disabling for now, using form onSubmit action instead: buffer.append(singleClickAction); } buffer.append("/>"); @@ -881,7 +881,7 @@ buffer.append('"'); } else { //add single click JS onclick - buffer.append(singleClickAction); + // disabling for now, using form onSubmit action instead: buffer.append(singleClickAction); } buffer.append("/>"); @@ -1049,6 +1049,8 @@ buffer.append("basic-form"); } buffer.append("\""); + + buffer.append(" onSubmit=\"javascript:submitFormDisableSubmits(this)\""); buffer.append(" name=\""); buffer.append(modelForm.getCurrentFormName(context)); |
Free forum by Nabble | Edit this page |