Skip to content
Snippets Groups Projects
Commit 04c7b20c authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

always send at least an emtpy <value> for every required fields when we send a...

always send at least an emtpy <value> for every required fields when we send a dataform. Fixes #5829
parent f1e6e924
No related branches found
No related tags found
No related merge requests found
......@@ -616,7 +616,7 @@ class CommandWindow:
cmdnode.setAttr('sessionid', self.sessionid)
if self.data_form_widget.data_form:
cmdnode.addChild(node=self.data_form_widget.data_form)
cmdnode.addChild(node=self.data_form_widget.data_form.get_purged())
def callback(response):
# FIXME: move to connection_handlers.py
......
......@@ -352,7 +352,7 @@ class StringField(DataField):
def fset(self, value):
assert isinstance(value, basestring)
if value == '':
if value == '' and not self.required:
return fdel(self)
self.setTagData('value', value)
......@@ -662,6 +662,11 @@ class SimpleDataForm(DataForm, DataRecord):
to_be_removed = []
for f in c.iter_fields():
if f.required:
# add <value> if there is not
if hasattr(f, 'value') and not f.value:
f.value = ''
if hasattr(f, 'values') and not f.values:
f.values = ['']
# Keep all required fields
continue
if (hasattr(f, 'value') and not f.value) or (hasattr(f, 'values') \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment