[Zope3-Users] Master-slave forms with formlib

Lorenzo Gil Sanchez lgs at sicem.biz
Mon Jul 10 02:58:34 EDT 2006


I want to write a form using the common pattern Master-Slave where there 
are some fields related to a master object and then a subform (the 
slave) with a tabular view of the children of that objet. Something 
similar to:

Personal Information

Name: [___________]
Age:  [___________]

| Name | Cellphone | City |
| Mary | 000000000 | NY   |
| Pete | 111111111 | LA   |

As you can see we have two content objects: Person and Friend where a 
person has two attributes (name and age) and friend has three attributes 
(name, cellphone and city).

First question:

- If I want to write a form with a master-slave sort of functionality 
how should I define my content types?:

   a) Person is a container that can contains objects of type Friend

   b) Person has a list attribute where I can add/remove objects of type 
Friend using a specific API

Second question:

- Can I write a subform with the Friends tabular view and reuse that 
form in other places, not just in the Person edit form? The minimun 
functionality this subform should have would be adding, removing and 
editing objects of type Friend. Sorting them by columns or filtering 
would be added in the future.

Any tip about how to do this using formlib would be appreciated. I have 
used it for simple content types and I like it a lot.

Thanks in advance

Lorenzo Gil

More information about the Zope3-users mailing list