<p dir="auto">Hi everybody.</p>
<p dir="auto">I have a problem with the validation message of my form GameType(). This Type ambed a collection of GameOnConsoleType().</p>
<p dir="auto">By following the doc : <a href="http://symfony.com/doc/current/cookbook/form/form_collections.html" rel="nofollow">http://symfony.com/doc/current/cookbook/form/form_collections.html</a>, my form works fine except validation messages.</p>
<p dir="auto">So, in my game form, I add 1 object GameOnConsole. I get the prototype html and replace <strong>name</strong> by 0. I add another object GameOnConsole so I replace <strong>name</strong> by 1.</p>
<p dir="auto">But now, if I delete the first GameOnConsole, my form will have only one GameOnConsole with index : 1.</p>
<p dir="auto">If this GameOnConsole violates a constraint, the violation will try to reach Object(Symfony\Component\Form\Form).data.gameOnConsoles[0]... which does not exist, because my GameOnConsole has the index 1.</p>
<p dir="auto">The version of Symfony is 2.5.</p>
<p dir="auto">I think it is a bug, the validator should use indexes that we passed in the form and not recalculate them.</p>
<p dir="auto">Thanks !</p>
<p dir="auto">I am coding a project along the lines of the cookbook entry on embedded collections as stated on: <a href="http://symfony.com/doc/current/cookbook/form/form_collections.html" rel="nofollow">http://symfony.com/doc/current/cookbook/form/form_collections.html</a>.</p>
<p dir="auto">I am considering the following use case:</p>
<ol dir="auto">
<li>Starting out with entering a new entity task, tag is the embedded collection</li>
<li>I click the Javascript 'add a tag'-link, which adds a bar 0 instance of the tag form</li>
<li>I click the Javascript 'add a tag'-link, which adds a bar 1 instance of the tag form</li>
<li>I click the Javascript 'add a tag'-link, which adds a bar 2 instance of the tag form</li>
<li>I click the Javascript 'delete this tag'-link for tag(1), which leaves me with the instances 0 and 2</li>
</ol>
<p dir="auto">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.</p>
<p dir="auto">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.</p>