Skip to content

[Form] Collection indices changed by adders are not reassigned #7468

@ghost

Description

I am coding a project along the lines of the cookbook entry on embedded collections as stated on: http://symfony.com/doc/current/cookbook/form/form_collections.html.

I am considering the following use case:

  1. Starting out with entering a new entity task, tag is the embedded collection
  2. I click the Javascript 'add a tag'-link, which adds a bar 0 instance of the tag form
  3. I click the Javascript 'add a tag'-link, which adds a bar 1 instance of the tag form
  4. I click the Javascript 'add a tag'-link, which adds a bar 2 instance of the tag form
  5. I click the Javascript 'delete this tag'-link for tag(1), which leaves me with the instances 0 and 2

Now, if I would leave all these tags blank (with a notblank validation on the tag name attribute), the returned form would be expected to visualize the error statements on instances 0 and 2. However, it turns out that the feedback is only displayed for instance 0.

If I change the returned form with firebug and set the instances on the name input field of instance 2 to '1', the feedback is displayed on the correct instance. This behavior indicates a mismatch between the indexing of the embedded form instances and the validators.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions