Hi Stephan. Thanks for your reply. For #2, the following excerpt from django's documentation located here:


And speaking of forms with dozens of fields, you might want to split the form up into fieldsets:

class Admin:
    fields = (
        (None, {'fields': ('question',)}),
        ('Date information', {'fields': ('pub_date',)}),

The first element of each tuple in fields is the title of the fieldset. Here’s what our form looks like now:

... image

You can assign arbitrary HTML classes to each fieldset. Django provides a "collapse" class that displays a particular fieldset initially collapsed. This is useful when you have a long form that contains a number of fields that aren’t commonly used:

class Admin:
    fields = (
        (None, {'fields': ('question',)}),
('Date information', {'fields': ('pub_date',), 'classes': 'collapse'}),

... image


I haven't thought of the best way of implementing this at this point since I am just coming up to speed with your package.

I very much like the suggestion of defining groups on the field manager. What you are suggesting is intuitive. In the django code, the group can be named, which provides an optional title for the field set for the form. Additionally, a class is passed in so you can use it for with some js to be initially collapsed when rendered. Similarly, these optional parameters would be useful to pass on.

values() seems logical for iterating over groups for the widget manager. I guess some thought on how the group (field set) itself may be integrated into a widget so a bit of js can be used to collapse and expand it would be the otherpart.

Unrelated to this is another small addition for the demo. This is to show a form with a couple of additional useful form buttons (another nice feature integrated in django forms)

Save and add another
Save and continue editing


Stephan Richter wrote:
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.

Zope3-users mailing list

Reply via email to