Commit d86c7f67 authored by Nicolas Delaby's avatar Nicolas Delaby

Add support required RadioField

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24489 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dee6fb77
...@@ -441,7 +441,7 @@ IntegerValidator.validate = IntegerValidator_validate ...@@ -441,7 +441,7 @@ IntegerValidator.validate = IntegerValidator_validate
def StringBaseValidator_validate(self, field, key, REQUEST): def StringBaseValidator_validate(self, field, key, REQUEST):
# We had to add this patch for hidden fields of type "list" # We had to add this patch for hidden fields of type "list"
value = REQUEST.get(key) value = REQUEST.get(key, REQUEST.get('default_%s' % (key, )))
if value is None: if value is None:
if field.get_value('required'): if field.get_value('required'):
raise Exception, 'Required field %s has not been transmitted. Check that all required fields are in visible groups.' % (repr(field.id), ) raise Exception, 'Required field %s has not been transmitted. Check that all required fields are in visible groups.' % (repr(field.id), )
...@@ -689,7 +689,10 @@ def SingleItemsWidget_render_view(self, field, value, REQUEST=None, render_prefi ...@@ -689,7 +689,10 @@ def SingleItemsWidget_render_view(self, field, value, REQUEST=None, render_prefi
return value return value
def RadioWidget_render(self, field, key, value, REQUEST, render_prefix=None): def RadioWidget_render(self, field, key, value, REQUEST, render_prefix=None):
input_hidden = render_element('input', type='hidden',
name="default_%s:int" % (key, ), value="")
rendered_items = self.render_items(field, key, value, REQUEST) rendered_items = self.render_items(field, key, value, REQUEST)
rendered_items.append(input_hidden)
orientation = field.get_value('orientation') orientation = field.get_value('orientation')
if orientation == 'horizontal': if orientation == 'horizontal':
return string.join(rendered_items, "  ") return string.join(rendered_items, "  ")
...@@ -797,7 +800,7 @@ def MultiCheckBoxWidget_render(self, field, key, value, REQUEST, render_prefix=N ...@@ -797,7 +800,7 @@ def MultiCheckBoxWidget_render(self, field, key, value, REQUEST, render_prefix=N
return string.join(rendered_items, "  ") return string.join(rendered_items, "  ")
else: else:
return string.join(rendered_items, "<br />") return string.join(rendered_items, "<br />")
MultiCheckBoxWidget.render = MultiCheckBoxWidget_render MultiCheckBoxWidget.render = MultiCheckBoxWidget_render
def ListWidget_render(self, field, key, value, REQUEST, render_prefix=None): def ListWidget_render(self, field, key, value, REQUEST, render_prefix=None):
......
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