Skip to content

Commit fbbe69a

Browse files
Moving "rendered page" codeblock upwards
1 parent 3371aab commit fbbe69a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

form/form_collections.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,18 +246,18 @@ and ``data-prototype`` attribute to the existing ``<ul>`` in your template:
246246

247247
<ul class="tags" data-index="{{ form.tags|length > 0 ? form.tags|last.vars.name + 1 : 0 }}" data-prototype="{{ form_widget(form.tags.vars.prototype)|e('html_attr') }}"></ul>
248248

249-
Now add a button just next to the ``<ul>`` to dynamically add a new tag:
250-
251-
.. code-block:: html+twig
252-
253-
<button type="button" class="add_item_link" data-collection-holder-class="tags">Add a tag</button>
254-
255249
On the rendered page, the result will look something like this:
256250

257251
.. code-block:: html
258252

259253
<ul class="tags" data-index="0" data-prototype="&lt;div&gt;&lt;label class=&quot; required&quot;&gt;__name__&lt;/label&gt;&lt;div id=&quot;task_tags___name__&quot;&gt;&lt;div&gt;&lt;label for=&quot;task_tags___name___name&quot; class=&quot; required&quot;&gt;Name&lt;/label&gt;&lt;input type=&quot;text&quot; id=&quot;task_tags___name___name&quot; name=&quot;task[tags][__name__][name]&quot; required=&quot;required&quot; maxlength=&quot;255&quot; /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;">
260254

255+
Now add a button just next to the ``<ul>`` to dynamically add a new tag:
256+
257+
.. code-block:: html+twig
258+
259+
<button type="button" class="add_item_link" data-collection-holder-class="tags">Add a tag</button>
260+
261261
.. seealso::
262262

263263
If you want to customize the HTML code in the prototype, see

0 commit comments

Comments
 (0)