#2341: tw.forms version 0.9.6 does not display validation errors with Form,
ListForm and TableForm
---------------------+------------------------------------------------------
Reporter: cd34 | Owner: Chris Arndt
Type: defect | Status: new
Priority: normal | Milestone:
Component: Widgets | Version: 2.0.1
Severity: normal | Keywords:
---------------------+------------------------------------------------------
If one uses a WidgetsList, and assigns a validator to a field widget, the
error message that should be displayed when a validation fails, is not
displayed. Validation does appear to work as the CSS classes for the
fields that failed validation are modified.
a very basic piece of code placed in root.py in a new virtual environment
with TG 2.0.1
I didn't see any documentation on this, but, Form doesn't display the
label_text. I am not sure if this is intentional or not.
{{{
from tw.core import WidgetsList
from tw.forms import Form, ListForm, TableForm, TextField, TextArea,
RadioButton
List, CheckBox, HiddenField, SingleSelectField, PasswordField
from tw.forms.validators import NotEmpty, Regex, Email
from pylons import c
from tg import redirect, validate, flash, request
class TestForm(TableForm):
action = 'testadd'
submit_text = 'Add test'
class fields(WidgetsList): #User = TextField()
User = TextField(label_text='FTP Username', size=40,
validator=NotEmpty())
#User = TextField(label_text='FTP Username', size=40,
validator=Email())
...
@expose('tg201.templates.template')
def form(self, **kw):
c.form = TestForm()
return dict(template='test',value=None)
@validate(TestForm(), error_handler=form)
def testadd(self, **kw):
flash('great success')
redirect('form')
}}}
template
{{{
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="">
${tmpl_context.form(value=value)}
</div>
}}}
If I install tw.forms-0.9.2.tar.gz or tw.forms-0.9.3dev-20090405.tar.gz,
validation error messages are displayed.
--
Ticket URL: <http://trac.turbogears.org/ticket/2341>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---