duplicate collection index if you delete an item and then add a new one
When using the collection widget, with the mopaboostrap-collection.js you can end up with duplicate indexes which results in either errors when processing the form values, or data going missing.
Easy to reproduce:
- Start with a collection of 3 items
- Delete the first item
- Add a new item
You will see that the second and newly created third item will have the same index of [2].
They only way to use the widget in it's current form is to add all the new items you need, and then delete the ones you don't just before saving

One solution would be the ability to set the initial_size variable via a data attribute on the widget in php
....
$builder->add(
'nice_email_collection_with_options',
'collection',
array(
'type' => 'email',
'attr' => array('data-collection-initial-size' => 3),
....
then using it in the collection plugin definition
$.fn.collection = function (option) {
var coll_args = arguments;
...
if($(collection_id).data('collection-initial-size')){
options.initial_size = $(collection_id).data('collection-initial-size');
}
Why is this still a problem? Are there any workarounds for this?
I assume because nobody has fixed it yet