Skip to content

[Form] Compound option explained #9283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions reference/forms/types/options/compound.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ compound

**type**: ``boolean`` **default**: ``true``

This option specifies if a form is compound. This is independent of whether
the form actually has children. A form can be compound but not have any
children at all (e.g. an empty collection form).
The compound option determines whether a form can have children,
in other words is a parent form for other forms.

In terms of data a compound form usually represents an object or an array.
In terms of view a compound form might be a simple ``<div>`` container or
a ``<form>`` element (the whole form).

A non compound form usually represents an object property or an array value
and is rendered with actual form elements: ``<input>`` (``TextType``, ``HiddenType``),
``<textarea>`` (``TextareType``) and ``<select>`` (``ChoiceType``).

A interesting case is the ``ChoiceType``. With ``expanded=false`` it is rendered as
a ``<select>`` form element and thus it is not a compound form. With ``expanded=true``
the ``ChoiceType`` is rendered as a set of radios or checkboxes and becomes a compound form.