Martin Aspeli a écrit :
> 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
>>>> [email protected]
>>>> 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
>
Yes I have started doing some codes to learn z3cform. The documentation
is very verbose but I have found a way of doing, you can find the code here:
http://plone.pastebin.com/m5590d336

The idea: using subforms and the more and fewer buttons will be
javascript + css effects that display or not the fields.

This code seems pretty good to me but failed with this error:
AttributeError: 'SearchForm' object has no attribute 'actions' .
It happens if I define the update method in the global search form. I
don't understand I m calling the upper class, so no differences. If
someone can help me on this, I would be glade. The complete trace is
here: http://plone.pastebin.com/m4f71b339

Now I m sure z3cform will fit with my needs.


-- 
Cordialement,
Jean-Michel FRANCOIS
Makina-Corpus



_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to