I handle a multi-tab form that is validated by one group per form-tab. When I get errors while binding request, I’d like to know the first tab (ie validation group) that is not valid.
Is it possible with Symfony 2.0, and how ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately this is currently not possible without hacking the core. The problem is that
Formcontains a references toFormErrorobjects, which do not keep references to the originalConstraintViolationobjects, which also do not keep references of the group under which the violation occurred.I recommend to open a feature request ticket on the issue tracker.
Even if we added this feature, the problem would remain that a constraint is only evaluated once if it belongs to multiple groups that are validated at once. The violation would then only store the first group, even though it would have failed in the other groups too.