Author: jleroux
Date: Sat Jul 26 02:47:13 2008
New Revision: 679975

URL: http://svn.apache.org/viewvc?rev=679975&view=rev
Log:
A fixing patch from Mridul Pathak "Implement Ajax.InPlaceEditor for display 
field in Form Widget" (https://issues.apache.org/jira/browse/OFBIZ-1859) - 
OFBIZ-1859
Some work still needed it seems

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Modified: 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=679975&r1=679974&r2=679975&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java 
(original)
+++ 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java 
Sat Jul 26 02:47:13 2008
@@ -159,20 +159,25 @@
      */
     public void renderDisplayField(Appendable writer, Map<String, Object> 
context, DisplayField displayField) throws IOException {
         ModelFormField modelFormField = displayField.getModelFormField();
+        ModelForm modelForm = modelFormField.getModelForm();
 
         StringBuffer str = new StringBuffer();
+        
+        String idName = modelFormField.getIdName();
+        if (UtilValidate.isNotEmpty(idName) && 
"list".equals(modelForm.getType())) {
+            idName += "_" + modelForm.getRowCount();
+        }
 
         if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle()) || 
modelFormField.shouldBeRed(context)) {
             str.append("<span class=\"");
             str.append(modelFormField.getWidgetStyle());
             str.append('"');
-            // add a style of red if this is a date/time field and redWhen is 
true
-            String idName = modelFormField.getIdName();
             if (UtilValidate.isNotEmpty(idName)) {
                 str.append(" id=\"");
                 str.append(idName);
                 str.append('"');
             }
+            // add a style of red if this is a date/time field and redWhen is 
true
             if (modelFormField.shouldBeRed(context)) {
                 str.append(" alert");
             }
@@ -218,7 +223,7 @@
                 }
             }
             writer.append("ajaxInPlaceEditDisplayField('");
-            writer.append(modelFormField.getIdName() + "', '" +url+ "', {");
+            writer.append(idName + "', '" +url+ "', {");
             if (UtilValidate.isNotEmpty(inPlaceEditor.getParamName())) {
                 writer.append("paramName: '" +inPlaceEditor.getParamName()+ 
"'");
             } else {


Reply via email to