Author: jleroux
Date: Thu Mar 19 14:39:40 2015 New Revision: 1667777 URL: http://svn.apache.org/r1667777 Log: Fixes <<You can't rely on Lookup field description-field-name attribute in a form having skip-start="true">> https://issues.apache.org/jira/browse/OFBIZ-6170 Instead of adding a form-name attribute only in lookup sub-element, I added it a the field level and removed the one at the lookup level.So the form-name field attribute can be used in the field of both the lookup and if needed the field set in the lookup description-field-name attribute. I only tested it in a version more near 13.07 but I believe it's ok here Modified: ofbiz/branches/release12.04/framework/widget/dtd/widget-form.xsd ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Modified: ofbiz/branches/release12.04/framework/widget/dtd/widget-form.xsd URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/widget/dtd/widget-form.xsd?rev=1667777&r1=1667776&r2=1667777&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/widget/dtd/widget-form.xsd (original) +++ ofbiz/branches/release12.04/framework/widget/dtd/widget-form.xsd Thu Mar 19 14:39:40 2015 @@ -553,6 +553,14 @@ under the License. </xs:documentation> </xs:annotation> </xs:attribute> + <xs:attribute type="xs:string" name="form-name"> + <xs:annotation> + <xs:documentation> + The name of the parent form, needed at least for lookups when using skip-start="true" + Must be set also on the related field if description-field-name is used + </xs:documentation> + </xs:annotation> + </xs:attribute> </xs:attributeGroup> <!-- ================== FIELD TYPES ==================== --> @@ -1139,13 +1147,6 @@ under the License. </xs:attribute> <xs:attribute name="confirmation-message" type="xs:string"><xs:annotation><xs:documentation>The message displayed in confirmation box</xs:documentation></xs:annotation></xs:attribute> </xs:attributeGroup> - <xs:attribute type="xs:string" name="form-name"> - <xs:annotation> - <xs:documentation> - The name of the parent form, needed when using skip-start="true" along with correct id-name value on field - </xs:documentation> - </xs:annotation> - </xs:attribute> <xs:element name="text" substitutionGroup="AllFields"> <xs:complexType> <xs:sequence> Modified: ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1667777&r1=1667776&r2=1667777&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Thu Mar 19 14:39:40 2015 @@ -2123,7 +2123,7 @@ public class MacroFormRenderer implement // add lookup pop-up button String descriptionFieldName = lookupField.getDescriptionFieldName(); - String formName = lookupField.getParentFormName(); + String formName = modelFormField.getParentFormName(); if (UtilValidate.isEmpty(formName)) { formName = modelFormField.getModelForm().getCurrentFormName(context); } Modified: ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1667777&r1=1667776&r2=1667777&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) +++ ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Thu Mar 19 14:39:40 2015 @@ -116,6 +116,7 @@ public class ModelFormField { protected Boolean sortField = null; protected String headerLink; protected String headerLinkStyle; + protected String parentFormName; /** On Change Event areas to be updated. */ protected List<UpdateArea> onChangeUpdateAreas; @@ -161,6 +162,7 @@ public class ModelFormField { this.sortField = fieldElement.hasAttribute("sort-field") ? "true".equals(fieldElement.getAttribute("sort-field")) : null; this.headerLink = fieldElement.getAttribute("header-link"); this.headerLinkStyle = fieldElement.getAttribute("header-link-style"); + this.parentFormName = fieldElement.getAttribute("form-name"); String positionStr = fieldElement.getAttribute("position"); @@ -973,7 +975,12 @@ public class ModelFormField { public String getIdName() { if (UtilValidate.isNotEmpty(idName)) return idName; - return this.modelForm.getName() + "_" + this.getFieldName(); + String parentFormName = this.getParentFormName(); + if (UtilValidate.isNotEmpty(parentFormName)) { + return parentFormName + "_" + this.getFieldName(); + } else { + return this.modelForm.getName() + "_" + this.getFieldName(); + } } public String getCurrentContainerId(Map<String, Object> context) { @@ -1260,6 +1267,11 @@ public class ModelFormField { } + public String getParentFormName() { + return this.parentFormName; + } + + public static abstract class FieldInfo { public static final int DISPLAY = 1; |
Free forum by Nabble | Edit this page |