Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

Formlib and multiple forms

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


charlie at begeistert

Apr 28, 2008, 6:30 AM

Post #1 of 3 (262 views)
Permalink
Formlib and multiple forms

Hi,

I'm not sure if I'm going about this the right way but I'm struggling
with using formlib to generate a group of forms / set of repeating
elements in what is effectively a grid. I think that either I need to
use a collection or a set of forms with different prefixes but I'm
still struggling a bit with this.

I have a concert object type that takes place in several cities so the
repeating element would be the city with the additional information
such as date, address and price. Effectively I have two schemas and
while I could, I suppose use two different objects (Concert &
Location), it is important that for the application that the Location
information for all venues can be edited at once: effectively a list
of dictionaries with each key corresponding to a field. Is it possible
to extend a schema like this? Alternatively, and I think this probably
makes more sense: how to do I get the form to be extended repeatedly
with the same interface but a different prefix?

Guidance much appreciated!

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


charlie at begeistert

Apr 28, 2008, 7:39 AM

Post #2 of 3 (242 views)
Permalink
Re: Formlib and multiple forms [In reply to]

Am 28.04.2008 um 15:30 schrieb Charlie Clark:

> Alternatively, and I think this probably makes more sense: how to do
> I get the form to be extended repeatedly with the same interface but
> a different prefix?


Ah, it looks like I've got this working:

def setUpWidgets(self, ignore_request=False):
self.widgets = []
for city in ["Paris", "New York"]:
self.adapters = {}
self.widgets += setUpWidgets(
self.form_fields, city, self.context, self.request,
form=self, adapters=self.adapters,
ignore_request=ignore_request)

Is this okay? Or is it a bad thing (TM)?

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


charlie at begeistert

Apr 28, 2008, 10:41 AM

Post #3 of 3 (247 views)
Permalink
Re: Formlib and multiple forms [In reply to]

Am 28.04.2008 um 16:39 schrieb Charlie Clark:

>
> Ah, it looks like I've got this working:
>
> def setUpWidgets(self, ignore_request=False):
> self.widgets = []
> for city in ["Paris", "New York"]:
> self.adapters = {}
> self.widgets += setUpWidgets(
> self.form_fields, city, self.context, self.request,
> form=self, adapters=self.adapters,
> ignore_request=ignore_request)
>
> Is this okay? Or is it a bad thing (TM)?


I guess it's a bad thing as the form buttons retain the prefix "form"
even if the widgets get "Paris" and "New York" prefixes. Oh well, back
to the drawing board.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.