[Zope3-dev] Re: Schemas, Fields and Fieldsets

Jim Fulton jim@zope.com
Sat, 29 Mar 2003 06:20:22 -0500


Steve Alexander wrote:
> Jim Fulton wrote:
> 
>> Marcus J. Ertl wrote:
>>
>>> Hi!
>>>
>>> Is it possible to group fields in schematas in a logic way, grouping
>>> them for example?
>>>
>>> Such a group could be rendered in a form as fieldset... 
>>
>>
>>
>> I don't know what this means. What do you mean by "grouping"?
>> What is a "fieldset"?
> 
> 
> I believe he means that if you have an interface with these fields:
> 

ascii art skipped.

> I had this kind of requirement for my big Zope 3 project, so I've 
> implemented a variant on the "edit form" class that is in Zope 3, which 
> handles this kind of presentation.
> 
> I was talking with Marius over lunch the other day, and we found that in 
> both our Zope 3 projects, we have many requirements for automatically 
> generated and validated forms that are not handled by the current Zope 3 
> implementations.
> 
> Our own implementations are somewhat crufty -- the emphasis being on 
> getting the job done, rather than making something suitable for general 
> use as part of a form/widget framework.
> 
> So, we agreed to spend some time writing down all of our requirements 
> for autogenerated forms, based on our recent experience and projected 
> furutre requirements. When we've got our set of requirements, we can 
> implement something that will meet these needs and offer it for 
> inclusion in Zope 3.

Sounds great.

I'll note that *one* way we were thinking about approaching this is with
nested schema. Something like:

class IContact(Interface):
    name = TextLine(...)
    email = TextLine(...)
    phone = TextLine(...)

class IMetaSyntax(Interface):
    foo = ...
    bar = ...
    baz = ...


class ISpam(Contact):
   contact = ComponentField(IContact)
   contact = ComponentField(IMetaSyntax)

and have composite widgets generated for component fields.

Of course, there are other options, including forms
on multi schemas.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (703) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org