@@ -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 =" < ; div> ;< ; label class=" ; required" ;> ; __name__< ; /label> ;< ; div id=" ; task_tags___name__" ;> ;< ; div> ;< ; label for=" ; task_tags___name___name" ; class=" ; required" ;> ; Name< ; /label> ;< ; input type=" ; text" ; id=" ; task_tags___name___name" ; name=" ; task[tags][__name__][name]" ; required=" ; required" ; maxlength=" ; 255" ; /> ;< ; /div> ;< ; /div> ;< ; /div> ; " >
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 =" < ; div> ;< ; label class=" ; required" ;> ; __name__< ; /label> ;< ; div id=" ; task_tags___name__" ;> ;< ; div> ;< ; label for=" ; task_tags___name___name" ; class=" ; required" ;> ; Name< ; /label> ;< ; input type=" ; text" ; id=" ; task_tags___name___name" ; name=" ; task[tags][__name__][name]" ; required=" ; required" ; maxlength=" ; 255" ; /> ;< ; /div> ;< ; /div> ;< ; /div> ; " >
306-
307312 The goal of this section will be to use JavaScript to read this attribute
308313and dynamically add new tag forms when the user clicks a "Add a tag" link.
309314To 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-
397397To make handling these new tags easier, add an "adder" and a "remover" method
398398for the tags in the ``Task `` class::
399399
0 commit comments