since Symfony 2.1 the validation_groups of the form view can be closures (http://symfony.com/doc/master/book/forms.html#groups-based-on-submitted-data).
It would be nice if the APYJsFormValidationBundle can be used with them too... at the moment there is thrown an error as followed:
An exception has been thrown during the rendering of a template ("Warning: in_array() expects parameter 2 to be array, object given in .../vendor/apy/jsfv-bundle/APY/JsFormValidationBundle/EventListener/ValidationGroupsListener.php line 35") in The Bundle::template.html.twig at line xx.
For now I don't have access to the form to do this.
i just looked a bit into it and maybe it isn't possible to realize something like this in a simple way :S
The closure for the validation_group needs a Form object but we have only the FormView object.
If your code doesn't need this form object in the closure, we can pass a fake Form object.
The problem is not misrepresented that the form is not available but that closure is called on form post-bind event.
yes.. so there is no simple way.. the "form object" is what is needed inside the closure.. else it doesn't make sense to have one..
the only (very complex) solution is to use ajax calls for this.. client-side validation using closures in validation_groups is impossible..
First of all we should fix code to avoid error messages. After that, you'll be able at least use custom js code.
In this bundle validation_groups is used only for filtering the fields, that should not be checked.
Fix error issue #22
If user uses Closure as validation_constraint value, this won't exclude
Are we close this issue ?