Commit 16d4ea79 authored by Romain Courteaud's avatar Romain Courteaud

Formulator: option value should not be an empty string

2nd try
parent 4bfcfe73
......@@ -1156,16 +1156,20 @@ class ListWidget(SingleItemsWidget):
return "\n".join([list_widget, input_hidden])
def render_item(self, text, value, key, css_class, extra_item):
if not text:
text = ' '
return self.render_element('option', contents=text, value=value,
extra=extra_item)
if text:
return self.render_element('option', contents=text, value=value,
extra=extra_item)
else:
return self.render_element('option', label=' ', value=value,
extra=extra_item)
def render_selected_item(self, text, value, key, css_class, extra_item):
if not text:
text = ' '
return self.render_element('option', contents=text, value=value,
selected=None, extra=extra_item)
if text:
return self.render_element('option', contents=text, value=value,
selected=None, extra=extra_item)
else:
return self.render_element('option', label=' ', value=value,
selected=None, extra=extra_item)
ListWidgetInstance = ListWidget()
......@@ -1199,16 +1203,20 @@ class MultiListWidget(MultiItemsWidget):
return "\n".join([multi_list,input_hidden])
def render_item(self, text, value, key, css_class, extra_item):
if not text:
text = ' '
return self.render_element('option', contents=text, value=value,
extra=extra_item)
if text:
return self.render_element('option', contents=text, value=value,
extra=extra_item)
else:
return self.render_element('option', label=' ', value=value,
extra=extra_item)
def render_selected_item(self, text, value, key, css_class, extra_item):
if not text:
text = ' '
return self.render_element('option', contents=text, value=value,
selected=None, extra=extra_item)
if text:
return self.render_element('option', contents=text, value=value,
selected=None, extra=extra_item)
else:
return self.render_element('option', label=' ', value=value,
selected=None, extra=extra_item)
MultiListWidgetInstance = MultiListWidget()
......
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