You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/03/04 11:38:19 UTC

svn commit: r1574022 - in /ofbiz/branches/release11.04: ./ framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Author: jleroux
Date: Tue Mar  4 10:38:18 2014
New Revision: 1574022

URL: http://svn.apache.org/r1574022
Log:
"Applied fix from trunk for revision: 1574019  " 
------------------------------------------------------------------------
r1574019 | jleroux | 2014-03-04 11:37:01 +0100 (mar. 04 mars 2014) | 16 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

jleroux: this second version works correctly
------------------------------------------------------------------------


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

Propchange: ofbiz/branches/release11.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1574019

Modified: ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1574022&r1=1574021&r2=1574022&view=diff
==============================================================================
--- ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/branches/release11.04/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Tue Mar  4 10:38:18 2014
@@ -999,6 +999,9 @@ public class ModelForm extends ModelWidg
             }
             //Debug.logInfo("In single form evaluating use-when for field " + currentFormField.getName() + ": " + currentFormField.getUseWhen(), module);
             if (!currentFormField.shouldUse(context)) {
+                if (UtilValidate.isNotEmpty(lastFormField)) {
+                    currentFormField = lastFormField;
+                }
                 continue;
             }
             alreadyRendered.add(currentFormField.getName());