Skip to content

Commit e427955

Browse files
ThomasLandauerjaviereguiluz
authored andcommitted
Moving the "On the rendered page" paragraph upwards
1 parent 95f5cc1 commit e427955

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

form/form_collections.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@ new "tag" forms. To render it, make the following change to your template:
280280
...
281281
</ul>
282282

283+
On the rendered page, the result will look something like this:
284+
285+
.. code-block:: html
286+
287+
<ul class="tags" 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;">
288+
289+
.. seealso::
290+
291+
If you want to customize the HTML code in the prototype, see
292+
:ref:`form-custom-prototype`.
293+
283294
.. note::
284295

285296
If you render your whole "tags" sub-form at once (e.g. ``form_row(form.tags)``),
@@ -298,12 +309,6 @@ new "tag" forms. To render it, make the following change to your template:
298309
299310
{{ form_widget(form.tags.vars.prototype.name)|e }}
300311
301-
On the rendered page, the result will look something like this:
302-
303-
.. code-block:: html
304-
305-
<ul class="tags" 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;">
306-
307312
The goal of this section will be to use JavaScript to read this attribute
308313
and dynamically add new tag forms when the user clicks a "Add a tag" link.
309314
To make things simple, this example uses jQuery and assumes you have it included
@@ -389,11 +394,6 @@ into new ``Tag`` objects and added to the ``tags`` property of the ``Task`` obje
389394

390395
You can find a working example in this `JSFiddle`_.
391396

392-
.. seealso::
393-
394-
If you want to customize the HTML code in the prototype, read
395-
:ref:`form-custom-prototype`.
396-
397397
To make handling these new tags easier, add an "adder" and a "remover" method
398398
for the tags in the ``Task`` class::
399399

0 commit comments

Comments
 (0)