Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ab1f822

Browse files
committed
minor #7767 Added caution block under delete_empty to warn the developer when he try to activate delete_empty for collections of compound forms (murilolobato, javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- Added caution block under delete_empty to warn the developer when he try to activate delete_empty for collections of compound forms Commits ------- ce30e47 Applied reviewer suggestion 52c0a94 Minor fix de25ede Minor reword ca04555 Improved format of message and added missing information. b9e375c Added caution block under delete_empty to warn the developer when he try to activate delete_empty for collections of compound forms.
2 parents f0bb193 + ce30e47 commit ab1f822

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

reference/forms/types/collection.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,15 @@ form you have to set this option to true. However, existing collection entries
273273
will only be deleted if you have the allow_delete_ option enabled. Otherwise
274274
the empty values will be kept.
275275

276+
.. caution::
277+
278+
The ``delete_empty`` option only removes items when the normalized value is
279+
``null``. If the nested `type`_ is a compound form type, you must either set
280+
the ``required`` option to ``false`` or set the ``empty_data`` option to
281+
``null``. Both of these options can be set inside `options`_. See
282+
:ref:`form's empty_data option <reference-form-option-empty-data>` to learn
283+
why this is necessary.
284+
276285
options
277286
~~~~~~~
278287

reference/forms/types/form.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ option on the form.
8080

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

83+
.. _reference-form-option-empty-data:
84+
8385
.. include:: /reference/forms/types/options/empty_data.rst.inc
8486
:end-before: DEFAULT_PLACEHOLDER
8587

0 commit comments

Comments
 (0)