[Product-Developers] Re: Complex Forms in Plone, which technologies to use: z3cform, CMFForm, ... ?

Martin Aspeli optilude+lists at gmail.com
Wed Aug 12 11:51:12 UTC 2009


Jean-Michel FRANCOIS wrote:
> Dylan Jay a écrit :
>> On 12/08/2009, at 1:11 AM, Jean-Michel FRANCOIS wrote:
>>
>>> Hi,
>>>
>>> I need to make a complex form this week. I need to do the same form as
>>> the contact advanced search inside thunderbird. For those who doesn't
>>> know it here is a screen shot:
>>> http://nsit.uchicago.edu/img/email/tbird-advanced-search.png
>>>
>>> The form is built by the user. He can add form fields define 'where' to
>>> search, ...
>> Do you mean that you want an admin user to be able to change the
>> schema (fields) through a web UI?
>> If so I don't think z3cform is for you. That is purely a code based
>> way setting up a form.
>> You want PloneFormGen if you want a to email the result or store the
>> information in a simple table. Otherwise I believe dexterity has a TTW
>> schema editing interface right? or at least planned to.
>>
>>
>>
>>> My question is:
>>> * Could I use z3cform to do this ? I have tried it but I need to define
>>> a schema. But in my case, I don't know the schema ... it seems not the
>>> good way
>>> * CMF FormController. I know how to do it with this technology, but it
>>> seems very old and I want my product to be fashionned and have a good
>>> future.
>>> * By hand ? Coding every things and do not use any other technologies
>>> than browserview.
>>> * Any other idea ?
>>>
>>> -- 
>>> Cordialement,
>>> Jean-Michel FRANCOIS
>>> Makina-Corpus
>>>
>>>
>>>
>>> _______________________________________________
>>> Product-Developers mailing list
>>> Product-Developers at lists.plone.org
>>> http://lists.plone.org/mailman/listinfo/product-developers
> No. I mean the user build the form. He is able to add or remove form
> field. What is a form field in this case: It is a set containing those
> things:
> 
> A select input with all indexes as options.
> A select input with constraints as options.
> An input type text where the user put the value he wants to search for.
> 
> The UI give the user the ability to add/remove as many form field as he
> wants throw two buttons: 'more' and 'fewer'.
> 
> But you have answered at one question: z3cform seems not appropriate. It
> is better for 'static' forms.

I'm not sure. You can change the set of fields and widgets quite easily 
in the update() method (or one of the methods it calls), e.g. in 
response to something in the request.

z3c.form would mainly give you fields, widget and validation. How you 
construct the set of fields is up to you. The most common (and most 
documented) pattern is to use an interface, but zope.schema fields can 
exist without an interface and forms can be constructed without a context.

But you should expect to spend a few days figuring out z3c.form. I'm not 
aware of any documentation or examples that cover your use case.

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book





More information about the Product-Developers mailing list