{"id":13561995,"url":"https://github.com/formapro/JsFormValidatorBundle","last_synced_at":"2025-04-03T17:32:13.880Z","repository":{"id":11366491,"uuid":"13801966","full_name":"formapro/JsFormValidatorBundle","owner":"formapro","description":"The Javascript validation for Symfony 2, 3 and 4 forms","archived":false,"fork":false,"pushed_at":"2022-05-06T12:21:18.000Z","size":1256,"stargazers_count":128,"open_issues_count":53,"forks_count":56,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-28T13:05:39.710Z","etag":null,"topics":["bundle","client-side","javascript-validation","php","symfony"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/formapro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-23T12:20:52.000Z","updated_at":"2023-06-07T11:07:36.000Z","dependencies_parsed_at":"2022-08-28T02:00:38.377Z","dependency_job_id":null,"html_url":"https://github.com/formapro/JsFormValidatorBundle","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formapro%2FJsFormValidatorBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formapro%2FJsFormValidatorBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formapro%2FJsFormValidatorBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formapro%2FJsFormValidatorBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/formapro","download_url":"https://codeload.github.com/formapro/JsFormValidatorBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247047166,"owners_count":20874786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundle","client-side","javascript-validation","php","symfony"],"created_at":"2024-08-01T13:01:03.382Z","updated_at":"2025-04-03T17:32:08.872Z","avatar_url":"https://github.com/formapro.png","language":"JavaScript","readme":"# FpJsFormValidatorBundle\n[![Build Status](https://travis-ci.com/formapro/JsFormValidatorBundle.svg?branch=master)](https://app.travis-ci.com/formapro/JsFormValidatorBundle)\n[![Total Downloads](https://poser.pugx.org/fp/jsformvalidator-bundle/downloads.png)](https://packagist.org/packages/fp/jsformvalidator-bundle)\n\nThis module enables validation of the Symfony 4 or later forms on the JavaScript side.\nIt converts form type constraints into JavaScript validation rules.\n\nIf you have Symfony 4.* - you need to use [Version 1.6.x-dev](https://github.com/formapro/JsFormValidatorBundle/tree/1.6)\n\nIf you have Symfony 3.1.* - you need to use [Version 1.5.*](https://github.com/formapro/JsFormValidatorBundle/tree/1.5)\n\nIf you have Symfony 3.0.* - you need to use [Version 1.4.*](https://github.com/formapro/JsFormValidatorBundle/tree/1.4)\n\nIf you have Symfony 2.8.* or 2.7.* - you need to use [Version 1.3.*](https://github.com/formapro/JsFormValidatorBundle/tree/1.3)\n\nIf you have Symfony 2.6.* or less - you need to use [Version 1.2.*](https://github.com/formapro/JsFormValidatorBundle/tree/1.2)\n\n## 1 Installation\u003ca name=\"p_1\"\u003e\u003c/a\u003e\n\n### 1.1 Download FpJsFormValidatorBundle using composer\u003ca name=\"p_1_1\"\u003e\u003c/a\u003e\n\nRun in terminal:\n```bash\n$ composer require \"fp/jsformvalidator-bundle\":\"dev-master\"\n```\nOr if you do not want to unexpected problems better to use exact version.\n```bash\n$ composer require \"fp/jsformvalidator-bundle\":\"v1.6.*\"\n```\n\n### 1.2 Enable javascript libraries\n\nThere are two ways to initialize javascript's files for this library. \nYou can create a new entry in the webpack or import the main file into your javascript.\n\n#### 1.2.1 Add FpJsFormValidatorBundle to webpack.config.js\n```diff\nEncore\n    ...\n    .addEntry('app', './assets/js/app.js')\n+   .addEntry('FpJsFormElement', './vendor/fp/jsformvalidator-bundle/Fp/JsFormValidatorBundle/Resources/public/js/FpJsFormValidatorWithJqueryInit.js')\n    ...\n    .configureBabel(null, {\n        useBuiltIns: 'usage',\n        corejs: 3,\n    })\n;\n```\n\nAnd include new entry in your template\n```diff\n+   {{ encore_entry_script_tags('FpJsFormElement') }}\n    {{ encore_entry_script_tags('app') }}\n```\n\n#### 1.2.2 Import FpJsFormValidatorBundle in your main javascript\n```diff\n  import $ from 'jquery';\n+  import 'path-to-bundles/fpjsformvalidator/js/FpJsFormValidator';\n+  import 'path-to-bundles/fpjsformvalidator/js/jquery.fpjsformvalidator';\n``` \n\n#### 1.2.3 Use inits in your template\n```diff\n{% block javascripts %}\n+   {{ js_validator_config() }}\n+   {{ init_js_validation() }}\n{% endblock %}\n```\n\n### 1.4 Add routes\u003ca name=\"p_1_4\"\u003e\u003c/a\u003e\n\nIf you use the UniqueEntity constraint, then you have to include the next part to your routing config: app/config/routing.yml\n```yaml\n# ...\nfp_js_form_validator:\n    resource: \"@FpJsFormValidatorBundle/Resources/config/routing.xml\"\n    prefix: /fp_js_form_validator\n```\nMake sure that your security settings do not prevent these routes.\n\n## 2 Usage\u003ca name=\"p_2\"\u003e\u003c/a\u003e\n\nAfter the previous steps the javascript validation will be enabled automatically for all your forms.\n\n1. [Disabling validation](src/Resources/doc/2_1.md)\u003ca name=\"p_2_1\"\u003e\u003c/a\u003e\n2. [If your forms are placed in sub-requests](src/Resources/doc/2_2.md)\u003ca name=\"p_2_2\"\u003e\u003c/a\u003e\n3. If you need to initialize JS validation for your forms separately, or by some event, in this case you need to follow [these steps](src/Resources/doc/2_3.md) instead of the [chapter 1.3](#p_1_3)\n\n## 3 Customization\u003ca name=\"p_3\"\u003e\u003c/a\u003e\n\n### Preface\n\nThis bundle finds related DOM elements for each element of a symfony form and attach to it a special object-validator.\nThis object contains list of properties and methods which fully define the validation process for the related form element.\nAnd some of those properties and methods can be changed to customize the validation process.\n\nIf you render forms with a some level of customization - read [this note](src/Resources/doc/3_0.md).\n\n1. [Disable validation for a specified field](src/Resources/doc/3_1.md)\n2. [Error display](src/Resources/doc/3_2.md)\n3. [Get validation groups from a closure](src/Resources/doc/3_3.md)\n4. [Getters validation](src/Resources/doc/3_4.md)\n5. [The Callback constraint](src/Resources/doc/3_5.md)\n6. [The Choice constraint. How to get the choices list from a callback](src/Resources/doc/3_6.md)\n7. [Custom constraints](src/Resources/doc/3_7.md)\n8. [Custom data transformers](src/Resources/doc/3_8.md)\n9. [Checking the uniqueness of entities](src/Resources/doc/3_9.md)\n10. [Form submit by Javasrcipt](src/Resources/doc/3_10.md)\n11. [onValidate callback](src/Resources/doc/3_11.md)\n12. [Run validation on custom event](Resources/doc/3_12.md)\n13. [Collections validation](src/Resources/doc/3_13.md)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformapro%2FJsFormValidatorBundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fformapro%2FJsFormValidatorBundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformapro%2FJsFormValidatorBundle/lists"}