Skip to content

Commit e5360fb

Browse files
tvlooyweaverryan
authored andcommitted
Update cookbook/form/form_collections.rst
index should start counting at 0 or form_errors() are rendered at the wrong field
1 parent 6ec07f7 commit e5360fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cookbook/form/form_collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ one example:
395395
396396
// Replace '$$name$$' in the prototype's HTML to
397397
// instead be a number based on the current collection's length.
398-
var newForm = prototype.replace(/\$\$name\$\$/g, collectionHolder.children().length);
398+
var newForm = prototype.replace(/\$\$name\$\$/g, collectionHolder.children().length - 1);
399399
400400
// Display the form in the page in an li, before the "Add a tag" link li
401401
var $newFormLi = $('<li></li>').append(newForm);

0 commit comments

Comments
 (0)