Skip to content

Commit 3371aab

Browse files
Mentioning data-index too
1 parent a1c167e commit 3371aab

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

form/form_collections.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,9 @@ it will receive an *unknown* number of tags. Otherwise, you'll see a
238238

239239
The ``allow_add`` option also makes a ``prototype`` variable available to you.
240240
This "prototype" is a little "template" that contains all the HTML needed to
241-
dynamically create any new "tag" forms with JavaScript. To render the prototype, add
242-
the following ``data-prototype`` attribute to the existing ``<ul>`` in your template:
241+
dynamically create any new "tag" forms with JavaScript. Now add the following
242+
``data-index`` (containing the current "form row" number for the following JavaScript)
243+
and ``data-prototype`` attribute to the existing ``<ul>`` in your template:
243244

244245
.. code-block:: html+twig
245246

@@ -265,7 +266,7 @@ On the rendered page, the result will look something like this:
265266
.. tip::
266267

267268
The ``form.tags.vars.prototype`` is a form element that looks and feels just
268-
like the individual ``form_widget(tag)`` elements inside your ``for`` loop.
269+
like the individual ``form_widget(tag.*)`` elements inside your ``for`` loop.
269270
This means that you can call ``form_widget()``, ``form_row()`` or ``form_label()``
270271
on it. You could even choose to render only one of its fields (e.g. the
271272
``name`` field):

0 commit comments

Comments
 (0)