[Grok-dev] Re: Inline edit forms

Martijn Faassen faassen at startifact.com
Tue Aug 14 12:30:46 EDT 2007

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" />

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.



More information about the Grok-dev mailing list