Skip to content

Commit bff80df

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [Forms] Use regular JavaScript functions in the examples
2 parents f759210 + 91c545f commit bff80df

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

form/form_collections.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ you'll replace with a unique, incrementing number (e.g. ``task[tags][3][name]``)
314314

315315
.. code-block:: javascript
316316
317-
const addFormToCollection = (e) => {
317+
function addFormToCollection(e) {
318318
const collectionHolder = document.querySelector('.' + e.currentTarget.dataset.collectionHolderClass);
319319
320320
const item = document.createElement('li');
@@ -579,7 +579,8 @@ on the server. In order for this to work in an HTML form, you must remove
579579
the DOM element for the collection item to be removed, before submitting
580580
the form.
581581

582-
First, add a "delete this tag" link to each tag form:
582+
In the JavaScript code, add a "delete" button to each existing tag on the page.
583+
Then, append the "add delete button" method in the function that adds the new tags:
583584

584585
.. code-block:: javascript
585586
@@ -591,7 +592,7 @@ First, add a "delete this tag" link to each tag form:
591592
592593
// ... the rest of the block from above
593594
594-
const addFormToCollection = (e) => {
595+
function addFormToCollection(e) {
595596
// ...
596597
597598
// add a delete link to the new form
@@ -602,7 +603,7 @@ The ``addTagFormDeleteLink()`` function will look something like this:
602603

603604
.. code-block:: javascript
604605
605-
const addTagFormDeleteLink = (item) => {
606+
function addTagFormDeleteLink(item) {
606607
const removeFormButton = document.createElement('button');
607608
removeFormButton.innerText = 'Delete this tag';
608609

0 commit comments

Comments
 (0)