[Zope3-dev] Re: [Zope3-Users] z3c.form 1.0.0 released!

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed May 30 13:35:52 EDT 2007

On Wednesday 30 May 2007 11:06, David Pratt wrote:
> 1) An iteration of the wizard that will not allow show submit button or
> allow submit until the end of all steps.

I have implemented this feature. The "Finish" button will now only show up 
when all required fields are filled out. You can update your z3c.formdemo 
checkout or download version 1.1.0.

> 2) A demo to show how fields can be grouped. Something like Django forms
> with grouping would be really nice.

My two standard answers for this are usually:

1. Use sub-forms. That's what they are for.

2. Grouping fields does not make much sense, since in projects you want to lay 
out widgets/fields manually anyways.

However, the first answer does not seem to fit your use case well and the 
second is a bummer for beginners. So, how would *you* like to see grouping of 
fields working?

There are several options here. For one, one could claim that interfaces 
already group fields, so I could use them to define groups:

  >>> fields = field.Fields(interfaces.IPerson)
  >>> fields.groups[IPerson].title = u'Person'

Another option would be to define groups on the fields manager:

  >>> fields = field.Fields(interfaces.IPerson, group='person')
  >>> fields.groups['person'].title = u'Person'

We could also reuse the prefex:

  >>> fields = field.Fields(interfaces.IPerson, prefix='person')
  >>> fields.groups['person'].title = u'Person'

Some other approaches could include making multiple "field.Fields" instances 
or have different "field.Field" implementations, similar to buttons.

The next question would then be how to iterate through the groups in the 
widget manager. Would this be okay?

  >>> widgets.groups['person'].values()

Anyways, let me know hoe it could be done and I think about it some more. A 
django example would be nice too.

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