wavydavy schrieb:
> Heya Diez
> 
> On Nov 17, 4:23 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]>
> wrote:
>> Hi,
>>
>> I'm having trouble defining nested widgets to properly reach down into my
>> data. I have the following situation:
>>
>> data = {
>>     name : {
>>                 'en' : 'Beamer',
>>                 'de' : 'Bildprojetor'
>>                 }
>>
>> }This is how I try and create a widget hierarchy that reflects the data:
>>
>> class Test(w.WidgetsList):
>>     en = w.TextField()
>>     de = w.TextField()
>>     nl = w.TextField()
>>
>> test = Test()
>>
>> class BookableWidgets(w.WidgetsList):
>>     name = w.FieldSet('name', fields=test)
>                                       ^^^^^^
> Note: underlined is unnecessary as that is what WidgetsList is for.
> It's auto-named.
> 
>> However, this will create a form that has the correct input names like this:
>> name.en
>> but it tries to fetch the values using just 'en' - not name.en.
> 
> By my reckoning , it doesn't create a form at all, just some nested
> widgets.
> Can you show us the form? How do you initialise and display() it?
> 
> I'm not sure I've read your question right, but if I have, I would
> expect something like this to work:
> 
> bookable_form = w.TableForm(fields=BookableWidgets())
> 
> value = dict(                      # value's for compound widgets (like
> forms) must be dicts
>     name=dict(                    # value for 'name' member widget,
> which is a fieldset and there for a compound widget
>         en='whatever',
>         de='whatever',
>         nl='whatever')
>     )
> )
> 
> bookable_form.display(value)
> 
> Does that help, or have I answered the wrong question?

Well, it helped, and you actually answered the right question. I was 
able to create a run-down example that behaved exactly as I was 
expecting it. However, what I showed you was a run-down example that 
captured what I hoped was the essence of my wrong-doings. Unfortunately, 
it seems that I have other troubles. I'm not sure which these are, though.

Thanks for your answer,


Diez

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