Commit 1fefa4d5 authored by Vincent Pelletier's avatar Vincent Pelletier

Formulator: Disable None-value entries.

Former behaviour for entry ('foo', None) was:
  <option value="value">foo</option>
With this change, it becomes:
  <option disabled="disabled">foo</option>
which was not possible to render before.
parent 93da8ed3
...@@ -1119,6 +1119,9 @@ class ListWidget(SingleItemsWidget): ...@@ -1119,6 +1119,9 @@ class ListWidget(SingleItemsWidget):
return "\n".join([list_widget, input_hidden]) return "\n".join([list_widget, input_hidden])
def render_item(self, text, value, key, css_class, extra_item): def render_item(self, text, value, key, css_class, extra_item):
if value is None:
return render_element('option', contents=text, disabled=None,
extra=extra_item)
return render_element('option', contents=text, value=value, return render_element('option', contents=text, value=value,
extra=extra_item) extra=extra_item)
...@@ -1158,6 +1161,9 @@ class MultiListWidget(MultiItemsWidget): ...@@ -1158,6 +1161,9 @@ class MultiListWidget(MultiItemsWidget):
return "\n".join([multi_list,input_hidden]) return "\n".join([multi_list,input_hidden])
def render_item(self, text, value, key, css_class, extra_item): def render_item(self, text, value, key, css_class, extra_item):
if value is None:
return render_element('option', contents=text, disabled=None,
extra=extra_item)
return render_element('option', contents=text, value=value, return render_element('option', contents=text, value=value,
extra=extra_item) extra=extra_item)
......
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