Nicky Ayoub wrote:
> Thanks for the idea, Ed. I've been playing around with callables but can't
> come up
> with something that can dynamically change the defaults on every invocation.
> I'll
> keep trying.
> Thanks again,
>

Hi Nicky,

You can change the default on every invocation by passing a dict (with
the right key) as value to the display method of any widget, in this
case a form widget.

For example, given a form like that:

class MyFields(WidgetsList):
      world_champion = SingleSelectField(options=[(1, "Italy"), (2,
"France")])

form = TableForm(fields=MyFields())

you can dynamically select the right option in this way:

form.display(value=dict(world_champion=1))

If you are using a MultipleSelectField you can pass a list of multiple
values, in this case there is only one world champion and this is
Italy... ;-)

Hope this helps.

Ciao
Michele


--~--~---------~--~----~------------~-------~--~----~
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