Thanks Stephan,

I have now got the sub form to render in browser.  Much appreciated.

A few more questions though.  In the create method, the data is only the
parent data.  The self.widgets.extract() returns only parent data.  The only
place I see the sub form data is in self.request.form.  What is the best way
to extract the data and create your object?

Perhaps unrelated but I had this working before. I'm using formui and I'm
getting a "TraversalError: (<ErrorViewSnippet for RequiredMissing>,
'widget')".  I tried to trim out all the sub-form stuff I've messed around
with and replaced a simple object with two textlines one of which is
required.  This happens when I'm submitting the form without an entry in
required field.  With data it works just fine and adds the object.  The
addform is using the macro:form from formui.  Any ideas as to where this
comes from and how I can fix it?

Thanks,

Mats Nordgren

> -----Original Message-----
> From: Stephan Richter [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 19, 2007 2:49 PM
> To: zope3-users@zope.org
> Cc: gnosis
> Subject: Re: [Zope3-Users] z3c.form and subforms in an AddForm?
> 
> On Friday 15 June 2007 13:52, gnosis wrote:
> > browser/restaurant.py
> >
> > class RestaurantAddForm(AddFormLayoutSupport, form.AddForm):
> >     """Add form"""
> ...
> 
> You do not need the layout support here, since this view does not render
> as a
> standalone Web page.
> 
> ...
> >     def update(self):
> >         self.address = AddressAddForm(self.context.address,
> self.request)
> > ## <---- Problem area
> >         self.address.update()
> >         super(RestaurantAddForm, self).update()
> ...
> 
> Simply pass in self.context.
> 
> > browser/address.py
> ...
> Looks good.
> 
> 
> > browser/configure.zcml
> ...
> >    <!-- Address Add Form -->
> >   <z3c:pagelet
> >     name="addAddress.html"
> >     for="metrod.restaurant.interfaces.IAddress"
> >     class=".address.AddressAddForm"
> >     layer="metrod.app.layer.IMetroDBrowserLayer"
> >     permission="zope.Public" />
> ...
> 
> This directive is not needed, since you never render it as a standalone
> Web
> page. You already instantiate the view within the person view's update()
> method.
> 
> BTW, you forgot the most interesting part. The templates. In the person
> view
> template you have to somewhere do this or something similar:
> 
> <div tal:replace="structure view/address/render" />
> 
> Regards,
> Stephan
> --
> Stephan Richter
> CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
> Web2k - Web Software Design, Development and Training

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to