I think you would do:

def getDefault(list):
    if list = "numbers":
        return "three"
#etc

then in your fields use a the callable to get your default value.

    numbers     = widgets.SingleSelectField ("Numbers",
options=opt_num, default=getDefault("numbers"))
    letters     = widgets.MultipleSelectField("Letters", options=
opt_let, default=getDefault("letters"))

but I'm not sure whether it calls the callable every time the form is
displayed.  If it does this will work fine.

Ed

On 7/8/06, Nicky Ayoub <[EMAIL PROTECTED]> wrote:
> Hello Fred.
>
> Yep, that I can do.
>
> How can I set that default values at method call time? For example,
> I have SO objects where I want to update some values but I need a
> way of showing the current values on the Single/MultiSelectField widgets of
> the form.
> I think I that I need to set the 'default' at display time. Is this even
> possible?
>
> In essence I need to change the  defaults  each time the method is invoked,
> depending on the object id passed in. I hope this explanation is more clear.
>
>
>
> On 7/8/06, gasolin <[EMAIL PROTECTED]> wrote:
> >
> > Hi Nicky :
> >
> > I'm not sure what you mean,
> > but if you mean how to make some option be "selected" by default,
> > You just add "default" in your Single/MultiSelectField widget as an
> > attribute.
> >
> > widgets.SingleSelectField("Numbers", options=opt_num, default=2)
> > widgets.MultipleSelectField("Letters", options= opt_let, ,
> > default=[1,2])
> >
> > You can check Single/MultiSelectField widget demo's source in toolbox's
> > widget browser .
> >
> > --
> > Fred
> >
> >
> >
>
>
>
> --
> --
> Nicky Ayoub
> G-Mail Account
>  >
>

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