svn commit: r1573162 - in /ofbiz/branches/release13.07: ./ framework/widget/src/org/ofbiz/widget/form/ModelForm.java

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

svn commit: r1573162 - in /ofbiz/branches/release13.07: ./ framework/widget/src/org/ofbiz/widget/form/ModelForm.java

jleroux@apache.org
Author: jleroux
Date: Sat Mar  1 12:16:22 2014
New Revision: 1573162

URL: http://svn.apache.org/r1573162
Log:
"Applied fix from trunk for revision: 1573161  "
------------------------------------------------------------------------
r1573161 | jleroux | 2014-03-01 13:15:33 +0100 (sam. 01 mars 2014) | 14 lignes

A patch from Leila Mekika for "Problems in single form when use-when and position are used together" https://issues.apache.org/jira/browse/OFBIZ-5552

The service "renderSingleFormString" check the previous field position to see if the current field must be displayed after the previous field or on a new line.

When the previous field has a use-when condition that is not valid, it remains as the currentFormField and the next field is compared with this "not rendered" field. If the position of this previous field is the same as the current field, the current is displayed on the next line.


To reproduce, add in a single form the three fields below :

<field position="1" name="first"><display description="first"/></field>
<field position="2" name="second" use-when="true"><display description="second"/></field>
<field position="2" name="second" use-when="false"><display description="second"/></field>

The field second is rendered on a new line
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release13.07/   (props changed)
    ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Propchange: ofbiz/branches/release13.07/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1573161

Modified: ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1573162&r1=1573161&r2=1573162&view=diff
==============================================================================
--- ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Sat Mar  1 12:16:22 2014
@@ -1059,6 +1059,7 @@ public class ModelForm extends ModelWidg
             }
             //Debug.logInfo("In single form evaluating use-when for field " + currentFormField.getName() + ": " + currentFormField.getUseWhen(), module);
             if (!currentFormField.shouldUse(context)) {
+                currentFormField = lastFormField;
                 continue;
             }
             alreadyRendered.add(currentFormField.getName());