On Feb 10, 2007, at 7:48 PM, Karl Guertin wrote:

>
> I'm looking to promote[1] a page to official status. My only complaint
> against it is that it makes the Schema approach sound like the only
> way to do chained_validators.
>
> [1] http://docs.turbogears.org/1.0/RoughDocs/FormValidationWithSchemas
>
> I distinctly remember being able to do chained validators as part of a
> widgets declaration but I can't remember how to do it nor do I see
> anything obvious in forms.py.

You can declare a Schema without any fields but chained and/or pre  
validators (or overriden methods) and place it as the form's  
validator. The form will copy it and extend it with all the child  
widget's validators

class MyForm(ListForm):
        validator = Schema(chained_validators=[...])
        fields = [
                TextField("foo", validator=Int),
                TextField("email", validator=Email),
        ]

The resulting schema will have the Int, and Email validators for the  
foo and email fields plus the chained validators declared as the  
form's Schema.

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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to