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
Cecil Westerhof  
View profile
 More options May 13, 7:20 am
From: "Cecil Westerhof" <cldwester...@gmail.com>
Date: Tue, 13 May 2008 13:20:57 +0200
Local: Tues, May 13 2008 7:20 am
Subject: Re: [TurboGears] Re: SingleSelectField of WidgetsList not properly updated
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.

--
Cecil Westerhof


    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