Skip to content

Commit 77ff125

Browse files
committed
minor #11944 Bug fix: Update collection.rst (MarvinBlstrli)
This PR was merged into the master branch. Discussion ---------- Bug fix: Update collection.rst form.children returns the children of the parent form, but at this point we need the length of children of the childform. Example: If form.children|length returns 3 and you add some childs the counter count up the data-widget-counter attribute. But after submit (with validation errors) the attribute has "3" again. Steps to reproduce: 1. Add form with child form as collection type like the documentation mentioned 2. Add validation to those fields 3. Check value of data-widget-counter 5. Click the "add" button and and some child fields (check value of data-widget-counter again) 5. Leave empty and submit the form 6. Now you see those fields with validation errors - check value of data-widget-counter - it has the same value from beginning (without fields added) and not the length of fields from child form Commits ------- 2814081 fix data-widget-counter
2 parents 864f6cc + 2814081 commit 77ff125

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

reference/forms/types/collection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ And update the template as follows:
184184
<ul id="email-fields-list"
185185
data-prototype="{{ form_widget(form.emails.vars.prototype)|e }}"
186186
data-widget-tags="{{ '<li></li>'|e }}"
187-
data-widget-counter="{{ form.children|length }}">
187+
data-widget-counter="{{ form.emails|length }}">
188188
{% for emailField in form.emails %}
189189
<li>
190190
{{ form_errors(emailField) }}

0 commit comments

Comments
 (0)