[Zope3-Users] Form for list of lists

Roger Ineichen dev at projekt01.ch
Thu Apr 14 04:10:32 EDT 2005


Hi Cliff 

From: zope3-users-bounces at zope.org 
> [mailto:zope3-users-bounces at zope.org] On Behalf Of Cliff Ford
> Sent: Thursday, April 14, 2005 9:43 AM
> To: Zope3-users at zope.org
> Subject: [Zope3-Users] Form for list of lists
> 
> I have a list of lists that I need to manipulate with a form. I have 
> figured out how to get the list elements into a form with a Page 
> Template. However, the field names come out like this:
> 
> 0 field.listname.0. field.listname.1. field.listname.2.
> 1 field.listname.0. field.listname.1. field.listname.2.
> 2 field.listname.0. field.listname.1. field.listname.2.
> ...
> 
> where the first integer is just the value of 
> repeat/item/index and the 
> first element represents listname[0][0].
> 
> I have a widget derived from SimpleInputWidget to handle the form 
> elements (all strings).
> 
> I don't know how to get the updated form values back into the list of 
> lists, or even the best/correct approach to this whole problem. Can 
> anyone provide some pointers?

Use the Field "List" in your interface for describe the list attribute.
Then use the standard "editform" directive with the right schema and 
all is handled by the form framework.

Then you should get values like:

field.list.0.name.0 field.list.0.name.1 field.list.0.name.2
field.list.1.name.0 field.list.1name.1 field.list.1.name.2


If you like to use a own edit form, you can call
request.get('yourfieldname', None)
for get a value. But make sure the fields have unique numbers.
Right now it seams each row uses the same numbers. 

Regards
Roger Ineichen

> Cliff
> 
> PS: Has yesterday's question from Dylan Reinhardt been answered 
> off-list? I will be doing the same thing next and was 
> interested in any 
> answers.
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
> 



More information about the Zope3-users mailing list