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

Commitec46d85

Browse files
committed
Merge branch '2.0' into 2.1
Conflicts:cookbook/form/form_collections.rst
2 parents6c9dc44 +3ab0a5c commitec46d85

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎cookbook/form/form_collections.rst‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,12 @@ one example:
400400
// Get the data-prototype explained earlier
401401
var prototype=collectionHolder.attr('data-prototype');
402402
403+
// count the current form inputs we have (e.g. 2), use that as the new index (e.g. 2)
404+
var newIndex=collectionHolder.find(':input').length;
405+
403406
// Replace '__name__' in the prototype's HTML to
404-
// instead be a number based onthe current collection's length.
405-
var newForm=prototype.replace(/__name__/g,collectionHolder.children().length-1);
407+
// instead be a number based onhow many items we have
408+
var newForm=prototype.replace(/__name__/g,newIndex);
406409
407410
// Display the form in the page in an li, before the "Add a tag" link li
408411
var $newFormLi=$('<li></li>').append(newForm);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp