Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rephrasing the "If you render your whole" note#13449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
ThomasLandauer wants to merge1 commit intosymfony:3.4fromThomasLandauer:patch-23
Closed
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletionsform/form_collections.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -280,12 +280,6 @@ new "tag" forms. To render it, make the following change to your template:
...
</ul>

.. note::

If you render your whole "tags" sub-form at once (e.g. ``form_row(form.tags)``),
then the prototype is automatically available on the outer ``div`` as
the ``data-prototype`` attribute, similar to what you see above.

.. tip::

The ``form.tags.vars.prototype`` is a form element that looks and feels just
Expand All@@ -304,6 +298,12 @@ On the rendered page, the result will look something like this:

<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;">

.. note::

If you render your whole "tags" sub-form at once (e.g. ``form_row(form.tags)``),
the ``data-prototype`` attribute is automatically added to the containing ``div``,
and you need to adjust the following JavaScript accordingly.

The goal of this section will be to use JavaScript to read this attribute
and dynamically add new tag forms when the user clicks a "Add a tag" link.
To make things simple, this example uses jQuery and assumes you have it included
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp