Using formencode.validators, I have a field which accepts an Int. I
also want it to validate NotEmpty.
How can I add both validations? The Int validator also accepts an
empty field.
Below is what I have. I want field foo to also validate against being
NotEmpty.
----
from tw.api import WidgetsList
from tw.forms import TableForm, TextField, Spacer
from formencode.validators import Int, NotEmpty
class BazForm(TableForm):
show_errors = True
fields = [
TextField('bar', validator=NotEmpty),
TextField('foo', validator=Int(min=100, max=999))]
create_baz_form = BazForm("create_baz_form", action='savenew')
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---