Commit 24b72cdb authored by Ivan Tyagov's avatar Ivan Tyagov

MultiItemsWidget should have at least one child in order to produce valid...

MultiItemsWidget should have at least one child in order to produce valid XHTML which should be disabled so user can not select it.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23074 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5b89d7a7
......@@ -712,6 +712,12 @@ def MultiItemsWidget_render_items(self, field, key, value, REQUEST, render_prefi
css_class = field.get_value('css_class')
extra_item = field.get_value('extra_item')
rendered_items = []
# multi items widget should have at least one child in order to produce
# valid XHTML disable it so user can not select it
if not len(items) :
return [self.render_item('','', '', '', 'disabled="1"')]
for item in items:
try:
item_text, item_value = item
......@@ -736,7 +742,6 @@ def MultiItemsWidget_render_items(self, field, key, value, REQUEST, render_prefi
key,
css_class,
extra_item)
rendered_items.append(rendered_item)
# XXX We want to make sure that we always have the current value in items. -yo
......
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