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.
So this works great and seems obviuos now, using this widget in a form:
widgets.MultipleSelectField(name="names", label="Names:",
options=[(1,'ian'),(2,'pete'),(3,'mike')],default=[1],validator=validators.Int())
And if needed, pass in at display time some dynamic
selections/options(in template):
${form(value=dict(names=nameValues),options=dict(names=nameOptions))}
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.
Thanks again for the response.
-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
-~----------~----~----~----~------~----~------~--~---