Reputation: 2674
I'm new to symfony 2 and i'm trying to build a standard form which should be validated by the server and by the navigator.
Server-side validation works fine with assertions like @Assert\...
but i cannot find a way to get this working on client side.
After searching, i pointed out that Symfony 2 does not have a javascript
library to manage this..
So my question is : What's the easiest way to do this ?
I know the possibility of using client side library like jQuery Validation
plugin or something like Regula, but that would means that i have to duplicate my validations rules..
Upvotes: 6
Views: 9873
Reputation: 450
This is new Symfony 2 bundle which provide implementation of client side validation for Symfony Types (forms) https://github.com/formapro/JsFormValidatorBundle
(This bundle is still being maintained and seems to have support for Symfony 4)
Upvotes: 0
Reputation: 12717
Symfony is a PHP framework, ie server-side application framework. It doesn't provide client-side validation unless you use HTML5 one with required
attribute and other email
type for input (that is still not very well implemented in browsers).
So you have to find your own solution and try to plug it in front of Symfony2 to make it as easy as possible... or find an existing bundle like APYJsFormValidationBundle
Upvotes: 7