[Grok-dev] Re: Inline edit forms

Darryl Cousins darryl at darrylcousins.net.nz
Tue Aug 14 23:43:13 EDT 2007


Hey,

On Tue, 2007-08-14 at 18:30 +0200, Martijn Faassen wrote:
> Sebastian Ware wrote:
> > I have a grok.Container() object that contains som grok.Model() objects. 
> > I want to edit the latter "inline" (master/detail view on the same page).
> > 
> > How do I create the form and form handling code for the inline edited 
> > child. Do I have to do it all manually using formlib, or can I use the 
> > grok edit form.
> > 
> 
>  From your later responses, you seem to be hunting for ways to make this 
> work using grok.Fields (or grok.AutoFields). I don't think that this is 
> the way to go.
> 
> The way I would approach this is to have a custom edit view on the 
> grok.Model objects, and then include them in the container's edit view 
> like this:
> 
> <tal:block repeat="obj python:context.values()">
>    <tal:block replace="structure obj/@@myeditview" />
> </tal:block>
> 
> This assumes there's a submit button rendered for each form separately.
> 
> Note that myeditview cannot have completely the default behavior. The 
> form action has to be submitted to the right place. The submit buttons 
> should redirect to the right place too.
> 
> There are various ways to do multiple forms on a single page with 
> formlib (including a single submit button, I think), but the details of 
> how to do this exactly escape me at present. This is an excellent 
> candidate for at least documentation and/or the grok treatment. Note 
> that z3c.form is on the horizon as well - Darryl may be able to provide 
> you with more information on how this might help your use case.

I agree with Martijn that you could manage to acheive sub-forms with
customised templates and other work.

z3c.form does provide a sub-form framework. The addressbook example in
z3c.formdemo demonstrates sub-forms. This example is duplicated with
grok/martian/mars in mars.formdemo.

http://svn.zope.org/z3c.formdemo/trunk/
http://svn.zope.org/Sandbox/darrylcousins/mars.formdemo/

Hope that helps,
Darryl

Best regards,
Darryl

> 
> Regards,
> 
> Martijn
> 
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev



More information about the Grok-dev mailing list