0

Does anyone know how to validate form on client-side using javascript. HTML5 validation it's not enough for me.

2 Answers 2

1

You can try using JsFormValidatorBundle:

Github repo

Packagist page

Hope this help. Let me know.

Sign up to request clarification or add additional context in comments.

Comments

0

My recomendation will be that you use this plugin http://jqueryvalidation.org/, it's great and really easy to use. You'll have to write some minimal javascript or go with data-* elements. See this example http://jqueryvalidation.org/files/demo/custom-messages-data-demo.html

Here is an example of validation in an UserType class:

...

->add('email', 'text', array (
                'required' => false,
                'attr' => array (
                    'placeholder' => 'Email',
                    'class' => 'form-control',
                    **'data-rule-required' => 'true'**
                )

...

3 Comments

It's possible to use validation rules defined in Symfony2?
As far as I know, the answer is no, at least with jquery-validation. But I have never tried JsFormValidatorBundle.
Why the downvote?? The question is about js validation. 3 years ago, jquery-validation was a great!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.