Skip to content

Added caution block under delete_empty to warn the developer when he try to activate delete_empty for collections of compound forms #7767

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

Merged
merged 5 commits into from
Jul 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions reference/forms/types/collection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,15 @@ form you have to set this option to true. However, existing collection entries
will only be deleted if you have the allow_delete_ option enabled. Otherwise
the empty values will be kept.

.. caution::

The ``delete_empty`` option only removes items when the normalized value is
``null``. If the nested `type`_ is a compound form type, you must either set
the ``required`` option to ``false`` or set the ``empty_data`` option to
``null``. Both of these options can be set inside `options`_. See
:ref:`form's empty_data option <reference-form-option-empty-data>` to learn
why this is necessary.

options
~~~~~~~

Expand Down
2 changes: 2 additions & 0 deletions reference/forms/types/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ option on the form.

.. include:: /reference/forms/types/options/data_class.rst.inc

.. _reference-form-option-empty-data:

.. include:: /reference/forms/types/options/empty_data.rst.inc
:end-before: DEFAULT_PLACEHOLDER

Expand Down