svn commit: r561872 - in /ofbiz/trunk/framework/widget/src/org/ofbiz/widget: form/ModelForm.java html/HtmlFormRenderer.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r561872 - in /ofbiz/trunk/framework/widget/src/org/ofbiz/widget: form/ModelForm.java html/HtmlFormRenderer.java

jacopoc
Author: jacopoc
Date: Wed Aug  1 10:04:48 2007
New Revision: 561872

URL: http://svn.apache.org/viewvc?view=rev&rev=561872
Log:
Added support for multiple submit fields in multi forms.

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?view=diff&rev=561872&r1=561871&r2=561872
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Wed Aug  1 10:04:48 2007
@@ -170,7 +170,7 @@
     protected List actions;
     protected List rowActions;
     protected FlexibleStringExpander rowCountExdr;
-    protected ModelFormField multiSubmitField;
+    protected List multiSubmitFields = FastList.newInstance();
     protected int rowCount = 0;
 
     // ===== CONSTRUCTORS =====
@@ -452,7 +452,7 @@
             ModelFormField modelFormField = new ModelFormField(fieldElement, this);
             ModelFormField.FieldInfo fieldInfo = modelFormField.getFieldInfo();
             if (thisType.equals("multi") && fieldInfo instanceof ModelFormField.SubmitField) {
-               multiSubmitField = modelFormField;
+               multiSubmitFields.add(modelFormField);
             } else {
                 modelFormField = this.addUpdateField(modelFormField);
             }
@@ -2418,8 +2418,8 @@
         return this.useRowSubmit;
     }
 
-    public ModelFormField getMultiSubmitField() {
-        return this.multiSubmitField;
+    public List getMultiSubmitFields() {
+        return this.multiSubmitFields;
     }
 
     public List getInbetweenList(FieldGroup startFieldGroup, FieldGroup endFieldGroup) {

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=561872&r1=561871&r2=561872
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Aug  1 10:04:48 2007
@@ -1100,25 +1100,28 @@
             buffer.append("<input type=\"hidden\" name=\"_useRowSubmit\" value=\"Y\"/>");
         }
         
-        ModelFormField submitField = modelForm.getMultiSubmitField();
-        if (submitField != null) {
+        Iterator submitFields = modelForm.getMultiSubmitFields().iterator();
+        while (submitFields.hasNext()) {
+            ModelFormField submitField = (ModelFormField)submitFields.next();
+            if (submitField != null) {
+
+                // Threw this in that as a hack to keep the submit button from expanding the first field
+                // Needs a more rugged solution
+                // WARNING: this method (renderMultiFormClose) must be called after the
+                // table that contains the list has been closed (to avoid validation errors) so
+                // we cannot call here the methods renderFormatItemRowCell*: for this reason
+                // they are now commented.
 
-            // Threw this in that as a hack to keep the submit button from expanding the first field
-            // Needs a more rugged solution
-            // WARNING: this method (renderMultiFormClose) must be called after the
-            // table that contains the list has been closed (to avoid validation errors) so
-            // we cannot call here the methods renderFormatItemRowCell*: for this reason
-            // they are now commented.
-            
-            // this.renderFormatItemRowCellOpen(buffer, context, modelForm, submitField);
-            // this.renderFormatItemRowCellClose(buffer, context, modelForm, submitField);
-            
-            // this.renderFormatItemRowCellOpen(buffer, context, modelForm, submitField);
+                // this.renderFormatItemRowCellOpen(buffer, context, modelForm, submitField);
+                // this.renderFormatItemRowCellClose(buffer, context, modelForm, submitField);
 
-            submitField.renderFieldString(buffer, context, this);
+                // this.renderFormatItemRowCellOpen(buffer, context, modelForm, submitField);
 
-            // this.renderFormatItemRowCellClose(buffer, context, modelForm, submitField);
-            
+                submitField.renderFieldString(buffer, context, this);
+
+                // this.renderFormatItemRowCellClose(buffer, context, modelForm, submitField);
+
+            }
         }
         buffer.append("</form>");
         this.appendWhitespace(buffer);
@@ -2322,7 +2325,7 @@
             }
             makeHyperlinkString(buffer, modelFormField.getHeaderLinkStyle(), targetType, targetBuffer.toString(), titleText, null);
         } else if (modelFormField.isRowSubmit()) {
-            if (UtilValidate.isNotEmpty(titleText)) buffer.append(titleText).append("<br>");
+            if (UtilValidate.isNotEmpty(titleText)) buffer.append(titleText).append("<br/>");
             buffer.append("<input type=\"checkbox\" name=\"selectAll\" value=\"Y\" onclick=\"javascript:toggleAll(this, '");
             buffer.append(modelFormField.getModelForm().getName());
             buffer.append("');\"/>");