zopyx
(Andreas Jung)
January 24, 2018, 6:42am
#1
We have a fairly complex content-types with about 100 fields where the fields are already grouped into fieldsets.
However we need another level of fieldsets inside a fieldset. E.g. the fieldset "contact" should provide fields for private and business address and therefore the fieldset "contact" should contain two sub fieldsets "private address" and "business address" with their related fields. The challenge on one head is to express the nested fieldsets either on the supermodel XML level or within the Python-based schema definition and on the other hand to render such a content-type (edit and view mode).
Any ideas?
-aj
tkimnguyen
(T. Kim Nguyen)
February 10, 2018, 4:53pm
#2
from https://docs.plone.org/develop/addons/schema-driven-forms/customising-form-behaviour/fieldsets.html it hints that z3c.form Groups functionality is still supported but isn't as obvious to use
===========
Group Forms
===========
Group forms allow you to split up a form into several logical units without
much overhead. To the parent form, groups should be only dealt with during
coding and be transparent on the data extraction level.
For the examples to work, we have to bring up most of the form framework:
>>> from z3c.form import testing
>>> testing.setupFormDefaults()
So let's first define a complex content component that warrants setting up
multiple groups:
>>> import zope.interface
>>> import zope.schema
>>> class IVehicleRegistration(zope.interface.Interface):
This file has been truncated. show original
Or maybe subforms would work too:
=========
Sub-Forms
=========
Traditionally, the Zope community talks about sub-forms in a generic manner
without defining their purpose, restrictions and assumptions. When we
initially talked about sub-forms for this package, we quickly noticed that
there are several classes of sub-forms with different goals.
Of course, we need to setup our defaults for this demonstration as well:
>>> from z3c.form import testing
>>> testing.setupFormDefaults()
Class I: The form within the form
---------------------------------
This class of sub-forms provides a complete form within a form, including its
own actions. When an action of the sub-form is submitted, the parent form
This file has been truncated. show original
Also this http://plone-product-developers.narkive.com/XZeW6tid/how-to-group-fields-in-dexterity-nested-fieldsets-possible (but I haven't looked)