On Jul 26, 2006, at 7:42 PM, Ian Wilson wrote:

>
> Thank you for the response.  I was either thinking too much or
> questionably not thinking.  I was trying to use some complicated
> validator for the MultipleSelectField when all I needed was a single
> Int() validator and it would know to apply that to the individual ids
> of the selected options.  And the complicated validator was
> prepossessing the values and so nothing was getting selected because
> it was really confused.

Yep, all SelectionFields (SingleSelectField, MultipleSelectField,  
CheckboxList, etc) build a formencode.ForEach validator with the  
validator you provide to validate individual list items AND to return  
a (python) list with them.

FYI, since 0.9a7 you can pass a ForEach (or a subclass) validator to  
a SelectionField if you need to perform some kind of validation on  
the list as a whole (for example, making sure at least 3 checkboxes  
are "checked").

> The schema information is good to know though.  Is there a place to
> find things out like that(Like the precedence of the schema over the
> form validators)?  I feel like I am running around in the dark.

I'm afraid there's not much more than you can find on the wiki,  
docs.turbogears.org (not much ATM) or by browsing some real-world  
code like Fastrack's (of course, you can always UTSL on TG, though it  
doesn't get much brighter... and is no excuse for good docs).

Hopefuly one of those typical Boring Spanish Summer Afternoons I'll  
get to write some docs covering widgets more in depth. (Un) 
fortunately they're not very boring lately... (and they're waaaay too  
warm !) ;)

Alberto

>
>
> -Ian
>
> On 7/26/06, Alberto <[EMAIL PROTECTED]> wrote:
>>
>>
>> Ian Wilson wrote:
>>> Sorry my point is it is not working.  Nothing is getting set.  It
>>> could be my wierd schema validator setup.  Will validators change  
>>> the
>>> values before the form is displayed even before a submittal?
>>> Can I give validators to each form element AND to the form  
>>> itself?  Like this:
>>> form = wigets.TableForm(fields=[widgets.TextField(name="color",
>>> validator=validators.String()], validator=MyFormSchema()])
>>
>> Yes tou can, a schema will be generated based on the schema you  
>> provide
>> to include all validators in the child widgets. If there's a clash
>> between a widget's validator and the one you provide in the  
>> schema, the
>> schema's will prevail.
>>
>>> I didn't want to list the form elements out in a schema AND the form
>>> but I also need to use NestedVariables.
>>
>> You shouldn't need the NestedVariables decoder because all request
>> params are automatically filtered by it by a CP filter. Try using a
>> Fieldset or a RepeatingFieldSet widget in a form to see what I mean.
>>
>> Back to the non-working MultipleSelectField: You're doing the correct
>> thing and it should work (tested it). If it doesn't, your custom
>> validator might be doing something funky. If you send me the smallest
>> quickstarted app that reproduces the problem I'll check it out ASAP.
>>
>> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to