svn commit: r453530 - in /incubator/ofbiz/trunk/framework: base/src/base/org/ofbiz/base/util/UtilHttp.java widget/src/org/ofbiz/widget/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: r453530 - in /incubator/ofbiz/trunk/framework: base/src/base/org/ofbiz/base/util/UtilHttp.java widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

jacopoc
Author: jacopoc
Date: Fri Oct  6 01:44:28 2006
New Revision: 453530

URL: http://svn.apache.org/viewvc?view=rev&rev=453530
Log:
Fixed bug reported in OFBIZ-222: Prev/Next links in multi forms are messed up after form is submitted.
This was caused by the presence in the links of the parameters submitted by the multi form.
I've fixed implementing a new method that takes as input the parameters map and returns as output a map without the multi-form parameters.

Modified:
    incubator/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java
    incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Modified: incubator/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java?view=diff&rev=453530&r1=453529&r2=453530
==============================================================================
--- incubator/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java (original)
+++ incubator/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java Fri Oct  6 01:44:28 2006
@@ -760,6 +760,25 @@
     }
 
     /**
+     * Returns a new map containing all the parameters from the input map except for the
+     * multi form parameters (usually named according to the ${param}_o_N notation).
+     */
+    public static Map removeMultiFormParameters(Map parameters) {
+        FastMap filteredParameters = new FastMap();
+        Iterator keys = parameters.keySet().iterator();
+        while (keys.hasNext()) {
+            String key = (String) keys.next();
+
+            if (key != null && (key.indexOf(MULTI_ROW_DELIMITER) != -1 || key.indexOf("_useRowSubmit") != -1 || key.indexOf("_rowCount") != -1)) {
+                continue;
+            }
+
+            filteredParameters.put(key, parameters.get(key));
+        }
+        return filteredParameters;
+    }
+
+    /**
      * Utility to make a composite parameter from the given prefix and suffix.
      * The prefix should be a regular paramter name such as meetingDate. The
      * suffix is the composite field, such as the hour of the meeting. The

Modified: incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?view=diff&rev=453530&r1=453529&r2=453530
==============================================================================
--- incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
+++ incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Fri Oct  6 01:44:28 2006
@@ -1114,6 +1114,10 @@
             queryString = (String)context.get("queryString");
         } else {
             Map inputFields = (Map)context.get("requestParameters");
+            // strip out any multi form fields if the form is of type multi
+            if (modelForm.getType().equals("multi")) {
+                inputFields = UtilHttp.removeMultiFormParameters(inputFields);
+            }
             queryString = UtilHttp.urlEncodeArgs(inputFields);
         }
         context.put("_QBESTRING_", queryString);