Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acseo/formjsvalidationbundle
Symfony Form Js Validation Bundle
https://github.com/acseo/formjsvalidationbundle
form-validation symfony symfony-bundle
Last synced: about 1 month ago
JSON representation
Symfony Form Js Validation Bundle
- Host: GitHub
- URL: https://github.com/acseo/formjsvalidationbundle
- Owner: acseo
- License: mit
- Created: 2017-06-23T10:19:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-01-02T20:59:53.000Z (almost 4 years ago)
- Last Synced: 2024-10-14T18:21:13.121Z (about 1 month ago)
- Topics: form-validation, symfony, symfony-bundle
- Language: PHP
- Size: 16.6 KB
- Stars: 5
- Watchers: 5
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ACSEO Form JS Validation Bundle
A bundle that add js validation to you forms
## Installation
1) Install using composer
```
composer require acseo/form-js-validation-bundle
```2) Update AppKernel.php :
```php
createForm(AwesomeEntityType::class, $awesomeEntity,array(
'action' => $this->generateUrl('awesomeentity_new'),
'method' => 'POST')
);// ...
$form = $this->get("acseo_form_js_validation.service")->addJsValidation($form);
// ...
```### Update templates
#### Using form validation.io
1) In your base template, use formvalidation js and css : http://formvalidation.io/getting-started/#usage
2) In the template when the form is used, just update the code with this :
```twig
{{ form_start(form, {'attr': { 'id' : 'awesome_entity_form', 'data-fv-framework' : 'bootstrap', }}) }}
{{ form_end(form)}}
$(document).ready(function() {
$('#awesome_entity_form').formValidation();
});```
#### Using form jqueryvalidation.org
1) In your base template, use jqueryvalidation js and css : https://github.com/jquery-validation/jquery-validation/releases
2) In the template when the form is used, just update the code with this :
```twig
{{ form_start(form, {'attr': {'id': 'awesome_entity_form'}}) }}
{{ form_end(form)}}
$(document).ready(function() {
$('#awesome_entity_form').validate();
});```