File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ you need is this JavaScript code:
149149 // add-collection-widget.js
150150 jQuery (document ).ready (function () {
151151 jQuery (' .add-another-collection-widget' ).click (function (e ) {
152- var list = jQuery (jQuery (this ).attr (' data-list' ));
152+ var list = jQuery (jQuery (this ).attr (' data-list-selector ' ));
153153 // Try to find the counter of the list or use the length of the list
154154 var counter = list .data (' widget-counter' ) | list .children ().length ;
155155
@@ -180,7 +180,8 @@ And update the template as follows:
180180 {# store the prototype on the data-prototype attribute #}
181181 <ul id="email-fields-list"
182182 data-prototype="{{ form_widget(form.emails.vars.prototype)|e }}"
183- data-widget-tags="{{ '<li></li>'|e }}">
183+ data-widget-tags="{{ '<li></li>'|e }}"
184+ data-widget-counter="{{ form.children|length }}">
184185 {% for emailField in form.emails %}
185186 <li>
186187 {{ form_errors(emailField) }}
@@ -191,7 +192,7 @@ And update the template as follows:
191192
192193 <button type="button"
193194 class="add-another-collection-widget"
194- data-list="#email-fields-list">Add another email</button>
195+ data-list-selector ="#email-fields-list">Add another email</button>
195196
196197 {# ... #}
197198 {{ form_end(form) }}
You can’t perform that action at this time.
0 commit comments