Commit a999c9f5 authored by Vincent Pelletier's avatar Vincent Pelletier

Prefix field id and selection name at rendering time so that it's possible to...

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.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22001 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 10540a3c
...@@ -563,10 +563,18 @@ class ListBoxRenderer: ...@@ -563,10 +563,18 @@ class ListBoxRenderer:
getSelectionTool = lazyMethod(getSelectionTool) 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): def getId(self):
"""Return the id of the field. Usually, "listbox". """Return the id of the field. Usually, "listbox".
""" """
return self.field.id return self.getPrefixedString(self.field.id)
getId = lazyMethod(getId) getId = lazyMethod(getId)
...@@ -688,7 +696,7 @@ class ListBoxRenderer: ...@@ -688,7 +696,7 @@ class ListBoxRenderer:
def getSelectionName(self): def getSelectionName(self):
"""Return the selection name. """Return the selection name.
""" """
return self.field.get_value('selection_name') return self.getPrefixedString(self.field.get_value('selection_name'))
getSelectionName = lazyMethod(getSelectionName) getSelectionName = lazyMethod(getSelectionName)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment