On 5/8/07, AZMel <[EMAIL PROTECTED]> wrote:

[...]

> A default value is set if I change the controller to this:
>
>     reach=SingleSelectField("Reach", options=lambda: [(t.id, t.reach)
> for t in Reach.select()], default=476)

Here "Reach" is the name of the widget and used as such...

> but not if it is this:
>
>     reach=SingleSelectField(label="Reach", options=lambda: [(t.id,
> t.reach) for t in Reach.select()], default=476)

Here your widget has no specified name... and a label with a value of "Reach"

> Why would the inclusion of 'label=' mess up setting the default?

Try something like this (a blind shot I did no test...):
reach=SingleSelectField(name="myname", label="Reach", options=...

In the template you cannot use the default argument. It is only used
in the constructor... but you can use "value" like this:

<span py:strip="True"
py:content="reach.display(value=someid)">SingleSelectField</span>

You should also try to not instantiate the widgets each time you go
through the method by only passing a callable to the options parameter
so it will be auto calculated on the fly. For this please look at this
post:

http://tinyurl.com/2lnksu

Alberto explains two different methods for this.

Cheers,

Florent.

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