|
|
|
|
Jean-Michel FRANCOIS
()
|
|
||||||||||||
|
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, ... 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 [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Martin Aspeli
()
|
|
||||||||||||
|
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, ... > > 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 ? You definitely can do it with z3c.form. You'll probably want to spend some time learning about the framework. It's very powerful, but what you want to do requires some work. The 'crud' stuff in plone.z3cform may be interesting for you, as would subforms in general be. Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book _______________________________________________ Product-Developers mailing list [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Dylan Jay
()
|
|
||||||||||||
|
In reply to this post
by Jean-Michel FRANCOIS
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 > [hidden email] > http://lists.plone.org/mailman/listinfo/product-developers _______________________________________________ Product-Developers mailing list [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Jean-Michel FRANCOIS
()
|
|
||||||||||||
|
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 >> [hidden email] >> http://lists.plone.org/mailman/listinfo/product-developers > 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. -- Cordialement, Jean-Michel FRANCOIS Makina-Corpus _______________________________________________ Product-Developers mailing list [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Jean-Michel FRANCOIS
()
|
|
||||||||||||
|
In reply to this post
by Martin Aspeli
Martin Aspeli a écrit :
> 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, ... >> >> 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 ? > > You definitely can do it with z3c.form. You'll probably want to spend > some time learning about the framework. It's very powerful, but what > you want to do requires some work. > > The 'crud' stuff in plone.z3cform may be interesting for you, as would > subforms in general be. > > Martin > -- Cordialement, Jean-Michel FRANCOIS Makina-Corpus _______________________________________________ Product-Developers mailing list [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Martin Aspeli
()
|
|
||||||||||||
|
In reply to this post
by Jean-Michel FRANCOIS
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 >>> [hidden email] >>> 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 _______________________________________________ Product-Developers mailing list [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Jean-Michel FRANCOIS
()
|
|
||||||||||||
|
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 >>>> [hidden email] >>>> 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 > 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 [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Laurent Mignon
()
|
|
||||||||||||
|
Jean-Michel FRANCOIS wrote:
> 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 >>>>> [hidden email] >>>>> 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 Update your searchForm before updating subforms. During subform update, the subform try to access the actions defined by parentForm. you can modify your code with: def update(self): super(SearchForm, self).update() for i in range(NUM_FIELDS): setattr(self, 'criteria-%s'%i, CriteriaForm(self.context, self.request, self)) getattr(self, 'criteria-%s'%i).update() or def update(self): super(SearchForm, self).updateActions() for i in range(NUM_FIELDS): setattr(self, 'criteria-%s'%i, CriteriaForm(self.context, self.request, self)) getattr(self, 'criteria-%s'%i).update() super(SearchForm, self).update() Since the update on parentForm call updatActions, I've the feeling that the first way is the right way > > Now I m sure z3cform will fit with my needs. > > _______________________________________________ Product-Developers mailing list [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Jean-Michel FRANCOIS
()
|
|
||||||||||||
|
Laurent Mignon a écrit :
> Jean-Michel FRANCOIS wrote: >> 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 >>>>>> [hidden email] >>>>>> 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 > > Update your searchForm before updating subforms. During subform > update, the subform try to access the actions defined by parentForm. > you can modify your code with: > > def update(self): > super(SearchForm, self).update() > for i in range(NUM_FIELDS): > setattr(self, 'criteria-%s'%i, > CriteriaForm(self.context, self.request, self)) > getattr(self, 'criteria-%s'%i).update() > or > def update(self): > super(SearchForm, self).updateActions() > for i in range(NUM_FIELDS): > setattr(self, 'criteria-%s'%i, > CriteriaForm(self.context, self.request, self)) > getattr(self, 'criteria-%s'%i).update() > super(SearchForm, self).update() > > Since the update on parentForm call updatActions, I've the feeling > that the first way is the right way >> >> Now I m sure z3cform will fit with my needs. >> >> > > > _______________________________________________ > Product-Developers mailing list > [hidden email] > http://lists.plone.org/mailman/listinfo/product-developers z3cform.subform explicitly show the way I was doing ... so may be updating the documentation will be nice. The code has been cleaned up a bit by using a list to store sub forms and I have also past the part of the documentation of z3c.form.subform: http://plone.pastebin.com/m5db665e5 I don't know if this is a bug coming from z3c.form or plone integration but It may need to be said somewhere... I have lost about one hour on this ... -- Cordialement, Jean-Michel FRANCOIS Makina-Corpus _______________________________________________ Product-Developers mailing list [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Laurent Mignon
()
|
|
||||||||||||
|
Jean-Michel FRANCOIS wrote:
> Laurent Mignon a écrit : >> Jean-Michel FRANCOIS wrote: >>> 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 >>>>>>> [hidden email] >>>>>>> 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 >> Update your searchForm before updating subforms. During subform >> update, the subform try to access the actions defined by parentForm. >> you can modify your code with: >> >> def update(self): >> super(SearchForm, self).update() >> for i in range(NUM_FIELDS): >> setattr(self, 'criteria-%s'%i, >> CriteriaForm(self.context, self.request, self)) >> getattr(self, 'criteria-%s'%i).update() >> or >> def update(self): >> super(SearchForm, self).updateActions() >> for i in range(NUM_FIELDS): >> setattr(self, 'criteria-%s'%i, >> CriteriaForm(self.context, self.request, self)) >> getattr(self, 'criteria-%s'%i).update() >> super(SearchForm, self).update() >> >> Since the update on parentForm call updatActions, I've the feeling >> that the first way is the right way >>> Now I m sure z3cform will fit with my needs. >>> >>> >> >> _______________________________________________ >> Product-Developers mailing list >> [hidden email] >> http://lists.plone.org/mailman/listinfo/product-developers > Thank you for the help, it fix the problem, but the documentation of > z3cform.subform explicitly show the way I was doing ... so may be > updating the documentation will be nice. > > The code has been cleaned up a bit by using a list to store sub forms > and I have also past the part of the documentation of z3c.form.subform: > http://plone.pastebin.com/m5db665e5 > but form.EditForm. So a CarForm instance is not a subform but a simple form.... In your code you use subform.EditSubFrom as baseclass for your CriteriaForm ... That's the difference > I don't know if this is a bug coming from z3c.form or plone integration > but It may need to be said somewhere... I have lost about one hour on > this ... > _______________________________________________ Product-Developers mailing list [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Encolpe DEGOUTE
()
|
|
||||||||||||
|
Laurent Mignon a écrit :
> Jean-Michel FRANCOIS wrote: >> Laurent Mignon a écrit : >>> Jean-Michel FRANCOIS wrote: >>>> 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 >>>>>>>> [hidden email] >>>>>>>> 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 >>> Update your searchForm before updating subforms. During subform >>> update, the subform try to access the actions defined by parentForm. >>> you can modify your code with: >>> >>> def update(self): >>> super(SearchForm, self).update() >>> for i in range(NUM_FIELDS): >>> setattr(self, 'criteria-%s'%i, >>> CriteriaForm(self.context, self.request, self)) >>> getattr(self, 'criteria-%s'%i).update() >>> or >>> def update(self): >>> super(SearchForm, self).updateActions() >>> for i in range(NUM_FIELDS): >>> setattr(self, 'criteria-%s'%i, >>> CriteriaForm(self.context, self.request, self)) >>> getattr(self, 'criteria-%s'%i).update() >>> super(SearchForm, self).update() >>> >>> Since the update on parentForm call updatActions, I've the feeling >>> that the first way is the right way >>>> Now I m sure z3cform will fit with my needs. >>>> >>>> >>> >>> _______________________________________________ >>> Product-Developers mailing list >>> [hidden email] >>> http://lists.plone.org/mailman/listinfo/product-developers >> Thank you for the help, it fix the problem, but the documentation of >> z3cform.subform explicitly show the way I was doing ... so may be >> updating the documentation will be nice. >> >> The code has been cleaned up a bit by using a list to store sub forms >> and I have also past the part of the documentation of z3c.form.subform: >> http://plone.pastebin.com/m5db665e5 >> > The example doesn't use subform.EditSubForm as base class for CarForm > but form.EditForm. So a CarForm instance is not a subform but a simple > form.... > > In your code you use subform.EditSubFrom as baseclass for your > CriteriaForm ... > > That's the difference > >> I don't know if this is a bug coming from z3c.form or plone integration >> but It may need to be said somewhere... I have lost about one hour on >> this ... >> You must remove the non relevant part of the message. -- Encolpe DEGOUTE http://encolpe.degoute.free.fr/ Logiciels libres, hockey sur glace et autres activités cérébrales _______________________________________________ Product-Developers mailing list [hidden email] http://lists.plone.org/mailman/listinfo/product-developers |
||||||||||||||
|
|
Sergey V.
()
|
|
||||||||||||
|
Wouldn't something like the following create functioality very similar to that scrteenshot:
class ICriterion(interface.Interface): """Search criteria""" index = schema.Choice(title=u"Index", values = [u"Last Name", u"First Name"]) constraint = schema.Choice(title=u"Constraint", values = [u"Contains", u"Doesn't contains"]) value = schema.TextLine(title=u"Value") class ISearchForm(interface.Interface): """Form with a list of subforms""" match_all = schema.Bool(title=u"Match All of the following", default=True) match_any = schema.Bool(title=u"Match Any of the following", default=False) criteria = zope.schema.List( title = u"My list field", value_type = zope.schema.Object( title=u'my object widget', schema=ICriterion), ) class SearchForm(form.Form): fields = field.Fields(ISearchForm) ... i.e. my understanding is that schema.List can render a list of subforms for its values along with Add and Remove buttons, everything magically working... I have to admit that I never tried that myself though. |
||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |