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
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
Prev Previous commit
Next Next commit
Improved format of message and added missing information.
  • Loading branch information
murilolobato committed Apr 8, 2017
commit ca045553edfd70e0321ca9f5068c32157b5112e2
16 changes: 9 additions & 7 deletions reference/forms/types/collection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,18 +268,20 @@ delete_empty

**type**: ``Boolean`` **default**: ``false``

.. caution::

Delete empty will only remove items when the normalized value is null.
If your `type`_ is a compound form type, you need to have the :ref:`required <reference-form-option-required>`
option set to ``false`` inside `options`_, See :ref:`empty_data <reference-form-option-empty-data>`.


If you want to explicitly remove entirely empty collection entries from your
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 will only remove items when the normalized
value is null. If your `type`_ is a compound form type, you need to have
the ``required`` option set to false or ``empty_data`` option explicitly
set to null, both these options can be set inside `options`_. To
understand why this is necessary, see form
:ref:`empty_data <reference-form-option-empty-data>`.

options
~~~~~~~

Expand Down