You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2007/03/16 17:28:24 UTC

svn commit: r519046 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Author: sichen
Date: Fri Mar 16 09:28:23 2007
New Revision: 519046

URL: http://svn.apache.org/viewvc?view=rev&rev=519046
Log:
Fix critical bug with multi-select form with patch from Scott Gray.  OFBIZ-812

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?view=diff&rev=519046&r1=519045&r2=519046
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Fri Mar 16 09:28:23 2007
@@ -1417,16 +1417,21 @@
 
             // read all option and entity-options sub-elements, maintaining order
             List childElements = UtilXml.childElementList(element);
-            Iterator childElementIter = childElements.iterator();
-            while (childElementIter.hasNext()) {
-                Element childElement = (Element) childElementIter.next();
-                if ("option".equals(childElement.getTagName())) {
-                    this.addOptionSource(new SingleOption(childElement, this));
-                } else if ("list-options".equals(childElement.getTagName())) {
-                    this.addOptionSource(new ListOptions(childElement, this));
-                } else if ("entity-options".equals(childElement.getTagName())) {
-                    this.addOptionSource(new EntityOptions(childElement, this));
+            if (childElements.size() > 0) {
+                Iterator childElementIter = childElements.iterator();
+                while (childElementIter.hasNext()) {
+                    Element childElement = (Element) childElementIter.next();
+                    if ("option".equals(childElement.getTagName())) {
+                        this.addOptionSource(new SingleOption(childElement, this));
+                    } else if ("list-options".equals(childElement.getTagName())) {
+                        this.addOptionSource(new ListOptions(childElement, this));
+                    } else if ("entity-options".equals(childElement.getTagName())) {
+                        this.addOptionSource(new EntityOptions(childElement, this));
+                    }
                 }
+            } else {
+                // this must be added or the multi-form select box options would not show up
+                this.addOptionSource(new SingleOption("Y", " ", this));
             }
         }