@@ -130,7 +130,8 @@ Notice that you embed a collection of ``TagType`` forms using the
130
130
$builder->add('description');
131
131
132
132
$builder->add('tags', CollectionType::class, array(
133
- 'entry_type' => TagType::class
133
+ 'entry_type' => TagType::class,
134
+ 'entry_options' => array('label' => false)
134
135
));
135
136
}
136
137
@@ -286,6 +287,7 @@ add the ``allow_add`` option to your collection field::
286
287
287
288
$builder->add('tags', CollectionType::class, array(
288
289
'entry_type' => TagType::class,
290
+ 'entry_options'=> array('label' => false),
289
291
'allow_add' => true,
290
292
));
291
293
}
@@ -392,9 +394,15 @@ one example:
392
394
// get the new index
393
395
var index = $collectionHolder .data (' index' );
394
396
397
+ var newForm = prototype;
398
+ // You need this only if you didn't set 'label' => false in your tags field in TaskType
399
+ // Replace '__name__label__' in the prototype's HTML to
400
+ // instead be a number based on how many items we have
401
+ // newForm = newForm.replace(/__name__label__/g, index);
402
+
395
403
// Replace '__name__' in the prototype's HTML to
396
404
// instead be a number based on how many items we have
397
- var newForm = prototype .replace (/ __name__/ g , index);
405
+ newForm = newForm .replace (/ __name__/ g , index);
398
406
399
407
// increase the index with one for the next item
400
408
$collectionHolder .data (' index' , index + 1 );
0 commit comments