Hi Max

Thanks so far. The most of the values are now right diplayed.
But now i had to extend my Form with a SingleSelectField.

My Definitions looks like this:

Controller...

class UserFields(widgets.WidgetsList):
    membertypeoptions = [(0, '')]

    for m in MemberType.select():
        membertypeoptions.append((int(m.id), m.name))

    id = widgets.HiddenField(name='id')
    user_name =
widgets.TextField(label='Username:',validator=validators.NotEmpty())
    membertype = widgets.SingleSelectField("membertype",
label='Membertype:', validator=validators.NotEmpty,
options=membertypeoptions)

user_form = TableForm(fields=UserFields(), action='save')

    @expose(template=".templates.admin.form")
    def edit(self, id = 0):
        user = User.get(id)
        return dict(active_section='user',
                    title='edit - ' + user.display_name,
                    navigations = navigations,
                    data = user,
                    form_widget = user_form)


mymodel...

class User(SQLObject):
    """
    Reasonably basic User definition. Probably would want additional attributes.
    """
    user_name = UnicodeCol( length=16, alternateID=True,
                           alternateMethodName="by_user_name" )
    membertype = ForeignKey("MemberType")

class MemberType(SQLObject):
    name = UnicodeCol(length=255)

in my template...
<data>
${form_widget.display(data)}
</data>


Here are the problem. When i go in edit mode user_name is filled
right, but the selected item in de Selectbox is always the first one.
Even when i have filld a value in Database.

Maybe someone can give me a hint?

Thanks in Advance.

Ivo Looser

2006/5/20, Max Ischenko <[EMAIL PROTECTED]>:
>
> Ivo,
>
> I'm sorry but what exactly your problem is?
>
> You pass data to a widget at display time, e.g.
> my_form.display(data)
>

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