[Zope3-Users] z3c.form: ListWidget, ObjectWidget, and subform

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Dec 7 18:14:28 EST 2007


On Friday 07 December 2007, Christophe Combelles wrote:
> z3c.form looks very well thought and extremely customizable, but I find it
> complicated for some common and simple cases. Does someone have any simple
> example apart from z3c.formdemo, to get the same result as the
> ListSequenceWidget and the ObjectWidget in the formlib?
>
> 1- The first thing I'm trying to create is a form for a
> List(value_type=TextLine) field.

Yep, this is a good one. When we originally wrote all the widgets, we simply 
forgot this one. I would welcome a patch. I think you could do much better 
though and easily come up with a widget that can handle several value types 
at once, i.e. by using the sub-form framework.

I also think that once you have such a list widget, you can also easily do one 
for Dict with simple key and value types.

> 2- Then I'm trying to create a form for a single Object field. I've
> understood that this case should be handled by a subform. So I could create
> such a thing by using a template for the main form, and a subtemplate for
> the subform. But then, I've begun using z3c.formui to have a better
> template for the main form, but now how do I display the subform in the
> div-based formui template?

This was my problem too. :-) Getting this generically right for a div-based 
layout is pretty difficult, especially for my CSS skills.

BTW, I am open to include an object widget implementation in z3c.form, but I 
want to review the code, since I want the object factory selection to be very 
clean. I could advice anyone interested in doing this work.

> The real final thing I'm trying to do is just a form for a
> List(value_type=Object(schema=IStuff),
> with IStuff being just  made of 3 TextLine fields.
> Doing this is quite easy with the formlib, or maybe I got used to it, but
> I'd really like to be able to do all the same things with z3c.form

I think you know enough about z3c.form to implement the widgets. Would you 
want to do that?

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list