Google Groups Home
Help | Sign in
Message from discussion SingleSelectField of WidgetsList not properly updated
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Diez B. Roggisch  
View profile
 More options May 13, 10:00 am
From: "Diez B. Roggisch" <de...@web.de>
Date: Tue, 13 May 2008 16:00:29 +0200
Local: Tues, May 13 2008 10:00 am
Subject: Re: [TurboGears] Re: SingleSelectField of WidgetsList not properly updated
On Tuesday 13 May 2008 13:20:57 Cecil Westerhof wrote:

> 2008/5/13 Diez B. Roggisch <de...@web.de>:
> >  > I only have one minor problem left. The other fields are filled
> >  > correctly for an edit. But for the owner field I have to set the
> >  > selected value with some javascript at the client side, because it is
> >  > not set. Is there a way to get the selected value rightly set?

> >  Yes - you can directly set values on forms by passing a proper
> > dictionary. Unfortunately I have to lookup that myself each time - but
> > searching this group will enlighten you even further.

> I found the solution. It was something completly different as where I
> was searching. And now I know the solution, it is very logical. ;-}

> In my model I have:
>     owner          = ForeignKey("Owner")

> In my WidgetsList class I had:
>     owner          = SingleSelectField(label     = ownerLabel,
>                                        options   = getOwners)
> but that should be:
>     ownerID        = SingleSelectField(label     = ownerLabel,
>                                        options   = getOwners)

> I'll change the other definitions also and then I can get rid of the
> ugly javascript I used for setting the good select.

> Maybe good to document this somewhere? To prevent other people
> stepping into this trap.

I'm not sure, but to me that looks buttugly. If you want that, instead create
a ModelValidator attached to SingleSelectField that will lookup a certain
owner-instance. I did that for myself, and maybe I'll get around to implement
that for TG11. But that depends on somebody testing/implementing it with SA,
as I solely use SO.

Diez


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google