[Erp5-report] r22001 - /erp5/trunk/products/ERP5Form/ListBox.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jun 27 11:31:38 CEST 2008


Author: vincent
Date: Fri Jun 27 11:31:29 2008
New Revision: 22001

URL: http://svn.erp5.org?rev=22001&view=rev
Log:
Prefix field id and selection name at rendering time so that it's possible to render multiple listboxes on the same page without getting duplicate html input tags.

Modified:
    erp5/trunk/products/ERP5Form/ListBox.py

Modified: erp5/trunk/products/ERP5Form/ListBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ListBox.py?rev=22001&r1=22000&r2=22001&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ListBox.py (original)
+++ erp5/trunk/products/ERP5Form/ListBox.py Fri Jun 27 11:31:29 2008
@@ -563,10 +563,18 @@
 
   getSelectionTool = lazyMethod(getSelectionTool)
 
+  def getPrefixedString(self, string):
+    prefix = self.render_prefix
+    if prefix is None:
+      result = string
+    else:
+      result = '%s_%s' % (prefix, string)
+    return result
+
   def getId(self):
     """Return the id of the field. Usually, "listbox".
     """
-    return self.field.id
+    return self.getPrefixedString(self.field.id)
 
   getId = lazyMethod(getId)
 
@@ -688,7 +696,7 @@
   def getSelectionName(self):
     """Return the selection name.
     """
-    return self.field.get_value('selection_name')
+    return self.getPrefixedString(self.field.get_value('selection_name'))
 
   getSelectionName = lazyMethod(getSelectionName)
 




More information about the Erp5-report mailing list