On May 11, 2006, at 12:38 AM, mulicheng wrote:
> s there a way to use validation on forms what are not widget Forms
> though? What about error messages?
Yep, you can pass a FE Schema instance to the validate() decorator.
Example:
class MySchema(Schema):
name = String(not_empty=True)
age = Int()
@validate(validator=MySchema())
@expose()
def process_form(self, name, age, tg_errors=None):
if tg_errors:
print tg_errors
# redisplay form with tg_errors
else:
# do something with input
However, I prefer leaving all that boring stuff to the Widget API ;)
HTH,
Alberto
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---