--- a/web/views/formrenderers.py Wed Jan 13 15:48:24 2010 +0100
+++ b/web/views/formrenderers.py Wed Jan 13 15:54:07 2010 +0100
@@ -127,9 +127,7 @@
# get extra errors
if errex is not None:
errormsg = req._('please correct the following errors:')
- displayed = form.form_displayed_errors
- errors = sorted((field, err) for field, err in errex.errors.items()
- if not field in displayed)
+ errors = form.remaining_errors()
if errors:
if len(errors) > 1:
templstr = '<li>%s</li>\n'
@@ -209,10 +207,10 @@
w(u'<tr class="%s_%s_row">' % (field.name, field.role))
if self.display_label:
w(u'<th class="labelCol">%s</th>' % self.render_label(form, field))
- error = form.form_field_error(field)
+ error = form.field_error(field)
if error:
w(u'<td class="error">')
- w(error)
+ self.render_error(w, error)
else:
w(u'<td>')
w(field.render(form, self))
@@ -231,6 +229,11 @@
w(u'<td>%s</td>\n' % button.render(form))
w(u'</tr></table>')
+ def render_error(self, w, err):
+ """return validation error for widget's field, if any"""
+ w(u'<span class="error">%s</span>' % err)
+
+
class BaseFormRenderer(FormRenderer):
"""use form_renderer_id = 'base' if you want base FormRenderer layout even
@@ -265,10 +268,10 @@
w(u'</tr>')
w(u'<tr>')
for field in fields:
- error = form.form_field_error(field)
+ error = form.field_error(field)
if error:
w(u'<td class="error">')
- w(error)
+ self.render_error(w, error)
else:
w(u'<td>')
w(field.render(form, self))
@@ -324,10 +327,10 @@
w(u'<td>%s</td>' % checkbox('eid', entity.eid,
checked=qeid in values))
for field in fields:
- error = form.form_field_error(field)
+ error = form.field_error(field)
if error:
w(u'<td class="error">')
- w(error)
+ self.render_error(w, error)
else:
w(u'<td>')
if isinstance(field.widget, (fwdgs.Select, fwdgs.CheckBox,