Skip to content

[Form] Shortening the text some more #14761

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 30, 2020
Merged
Changes from all 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
11 changes: 2 additions & 9 deletions form/form_collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ the following ``data-prototype`` attribute to the existing ``<ul>`` in your temp

<ul class="tags" data-prototype="{{ form_widget(form.tags.vars.prototype)|e('html_attr') }}"></ul>

Now add a button just next to the ``<ul>`` to dynamically add a new tag
Now add a button just next to the ``<ul>`` to dynamically add a new tag:

.. code-block:: html+twig

Expand Down Expand Up @@ -284,9 +284,7 @@ The goal of this section will be to use JavaScript to read this attribute
and dynamically add new tag forms when the user clicks the "Add a tag" button.
This example uses jQuery and assumes you have it included somewhere on your page.

Add a ``script`` tag somewhere on your page so you can start writing some
JavaScript. In this script, bind to the "click" event of the "Add a tag"
button so you can add a new tag form (``addFormToCollection()`` will be show next):
Now add the required functionality with JavaScript:

.. code-block:: javascript

Expand Down Expand Up @@ -344,11 +342,6 @@ one example:
$collectionHolder.append($newFormLi)
}

.. note::

It is better to separate your JavaScript in real JavaScript files than
to write it inside the HTML as is done here.

Now, each time a user clicks the ``Add a tag`` link, a new sub form will
appear on the page. When the form is submitted, any new tag forms will be converted
into new ``Tag`` objects and added to the ``tags`` property of the ``Task`` object.
Expand Down