Skip to content

Commit b0a4345

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Rephrasing the "If you render your whole" note (2nd attempt) add empty_data to the form HiddenType
2 parents 8671540 + 44d77e5 commit b0a4345

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

form/form_collections.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,6 @@ On the rendered page, the result will look something like this:
268268
If you want to customize the HTML code in the prototype, see
269269
:ref:`form-custom-prototype`.
270270

271-
.. note::
272-
273-
If you render your whole "tags" sub-form at once (e.g. ``form_row(form.tags)``),
274-
then the prototype is automatically available on the outer ``div`` as
275-
the ``data-prototype`` attribute, similar to what you see above.
276-
277271
.. tip::
278272

279273
The ``form.tags.vars.prototype`` is a form element that looks and feels just
@@ -286,6 +280,12 @@ On the rendered page, the result will look something like this:
286280
287281
{{ form_widget(form.tags.vars.prototype.name)|e }}
288282
283+
.. note::
284+
285+
If you render your whole "tags" sub-form at once (e.g. ``form_row(form.tags)``),
286+
the ``data-prototype`` attribute is automatically added to the containing ``div``,
287+
and you need to adjust the following JavaScript accordingly.
288+
289289
The goal of this section will be to use JavaScript to read this attribute
290290
and dynamically add new tag forms when the user clicks a "Add a tag" link.
291291
This example uses jQuery and assumes you have it included somewhere on your page.

reference/forms/types/hidden.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The hidden type represents a hidden input field.
1515
+-------------+----------------------------------------------------------------------+
1616
| Inherited | - `attr`_ |
1717
| options | - `data`_ |
18+
| | - `empty_data`_ |
1819
| | - `error_mapping`_ |
1920
| | - `mapped`_ |
2021
| | - `property_path`_ |
@@ -55,6 +56,8 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
5556

5657
.. include:: /reference/forms/types/options/data.rst.inc
5758

59+
.. include:: /reference/forms/types/options/empty_data.rst.inc
60+
5861
.. include:: /reference/forms/types/options/error_mapping.rst.inc
5962

6063
.. include:: /reference/forms/types/options/mapped.rst.inc

0 commit comments

Comments
 (0)