Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection add generates invalid new name / keys when using subcollection #221

Closed
joschi127 opened this issue Apr 27, 2014 · 2 comments
Closed
Labels

Comments

@joschi127
Copy link

First of all: thanks a lot for the awesome Bootstrap forms integration for Symfony. I started implementing the same thing, but much simpler, myself and then came across your bundle and I like it very much and it saved me a lot of time.

One problem tough when using collections:

As far as I can see there is a bug in bc-bootstrap-collection.js.

I can also reproduce it on the playground page: http://bootstrap.braincrafted.com/playground/forms.html

Steps to reproduce:

  • use 2 levels of collection (a collection with a subcollection)
  • remove all entries or start with an empty collection
  • add entry 1
  • add sub entry 1.1
  • add entry 2
  • add sub entry 2.1

=> entry 1 will have key [0] and entry 1.1 will have the keys [0] [0] - which is correct

=> entry 2 will have key [2] but entry 2.1 will have the keys [1] [1] - I think entry 2 should have the key [1] instead of [2]

Thanks!

@joschi127
Copy link
Author

PS:

I think the fix is to change line 37 of bc-bootstrap-collection.js:

Current version:
count = list.find('li').size()

Fixed version:
count = list.find('> li').size()

Am I right? At least this fixes the bug for me.

@florianeckerstorfer
Copy link
Member

This should be fixed in #224.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants