PHPackages                             shopsys/jsformvalidator-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. shopsys/jsformvalidator-bundle

ActiveSymfony-bundle[Validation &amp; Sanitization](/categories/validation)

shopsys/jsformvalidator-bundle
==============================

Javascript validation for Symfony forms.

2.0(1y ago)0139.3k—8.4%MITJavaScriptPHP ^8.3

Since Dec 9Pushed 1y agoCompare

[ Source](https://github.com/shopsys/JsFormValidatorBundle)[ Packagist](https://packagist.org/packages/shopsys/jsformvalidator-bundle)[ Docs](https://github.com/shopsys/JsFormValidatorBundle)[ RSS](/packages/shopsys-jsformvalidator-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (18)Versions (33)Used By (0)

FpJsFormValidatorBundle
=======================

[](#fpjsformvalidatorbundle)

[![Build and tests](https://github.com/shopsys/JsFormValidatorBundle/actions/workflows/run-checks-tests.yaml/badge.svg)](https://github.com/shopsys/JsFormValidatorBundle/actions/workflows/run-checks-tests.yaml)[![Total Downloads](https://camo.githubusercontent.com/6b688c0f52cb5fee916afa9280c1722fcc04069f5d5b63cdfc3e6e81f49254b4/68747470733a2f2f706f7365722e707567782e6f72672f73686f707379732f6a73666f726d76616c696461746f722d62756e646c652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/shopsys/jsformvalidator-bundle)

This module enables validation of the Symfony 4 or later forms on the JavaScript side. It converts form type constraints into JavaScript validation rules.

If you have Symfony 4.4 or 5.x - you need to use [Version 1.7.x](https://github.com/shopsys/JsFormValidatorBundle/tree/1.7)

If you have Symfony 4.\* - you need to use [Version 1.6.x-dev](https://github.com/shopsys/JsFormValidatorBundle/tree/1.6)

If you have Symfony 3.1.\* - you need to use [Version 1.5.\*](https://github.com/shopsys/JsFormValidatorBundle/tree/1.5)

If you have Symfony 3.0.\* - you need to use [Version 1.4.\*](https://github.com/shopsys/JsFormValidatorBundle/tree/1.4)

If you have Symfony 2.8.\* or 2.7.\* - you need to use [Version 1.3.\*](https://github.com/shopsys/JsFormValidatorBundle/tree/1.3)

If you have Symfony 2.6.\* or less - you need to use [Version 1.2.\*](https://github.com/shopsys/JsFormValidatorBundle/tree/1.2)

1 Installation
---------------------------------------------

[](#1-installation)

### 1.1 Download FpJsFormValidatorBundle using composer

[](#11-download-fpjsformvalidatorbundle-using-composer)

Run in terminal:

```
$ composer require "shopsys/jsformvalidator-bundle":"dev-master"
```

Or if you do not want to unexpected problems better to use exact version.

```
$ composer require "shopsys/jsformvalidator-bundle":"v1.6.*"
```

### 1.2 Enable javascript libraries

[](#12-enable-javascript-libraries)

There are two ways to initialize javascript's files for this library. You can create a new entry in the webpack or import the main file into your javascript.

#### 1.2.1 Add FpJsFormValidatorBundle to webpack.config.js

[](#121-add-fpjsformvalidatorbundle-to-webpackconfigjs)

```
Encore
    ...
    .addEntry('app', './assets/js/app.js')
+   .addEntry('FpJsFormElement', './vendor/fp/jsformvalidator-bundle/Fp/JsFormValidatorBundle/Resources/public/js/FpJsFormValidatorWithJqueryInit.js')
    ...
    .configureBabel(null, {
        useBuiltIns: 'usage',
        corejs: 3,
    })
;
```

And include new entry in your template

```
+   {{ encore_entry_script_tags('FpJsFormElement') }}
    {{ encore_entry_script_tags('app') }}
```

#### 1.2.2 Import FpJsFormValidatorBundle in your main javascript

[](#122-import-fpjsformvalidatorbundle-in-your-main-javascript)

```
  import $ from 'jquery';
+  import 'path-to-bundles/fpjsformvalidator/js/FpJsFormValidator';
+  import 'path-to-bundles/fpjsformvalidator/js/jquery.fpjsformvalidator';
```

#### 1.2.3 Use inits in your template

[](#123-use-inits-in-your-template)

```
{% block javascripts %}
+   {{ js_validator_config() }}
+   {{ init_js_validation() }}
{% endblock %}
```

### 1.4 Add routes

[](#14-add-routes)

If you use the UniqueEntity constraint, then you have to include the next part to your routing config: app/config/routing.yml

```
# ...
fp_js_form_validator:
    resource: "@FpJsFormValidatorBundle/Resources/config/routing.xml"
    prefix: /fp_js_form_validator
```

Make sure that your security settings do not prevent these routes.

2 Usage
--------------------------------------

[](#2-usage)

After the previous steps the javascript validation will be enabled automatically for all your forms.

1. [Disabling validation](src/Resources/doc/2_1.md)
2. [If your forms are placed in sub-requests](src/Resources/doc/2_2.md)
3. 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)

3 Customization
----------------------------------------------

[](#3-customization)

### Preface

[](#preface)

This bundle finds related DOM elements for each element of a symfony form and attach to it a special object-validator. This object contains list of properties and methods which fully define the validation process for the related form element. And some of those properties and methods can be changed to customize the validation process.

If you render forms with a some level of customization - read [this note](src/Resources/doc/3_0.md).

1. [Disable validation for a specified field](src/Resources/doc/3_1.md)
2. [Error display](src/Resources/doc/3_2.md)
3. [Get validation groups from a closure](src/Resources/doc/3_3.md)
4. [Getters validation](src/Resources/doc/3_4.md)
5. [The Callback constraint](src/Resources/doc/3_5.md)
6. [The Choice constraint. How to get the choices list from a callback](src/Resources/doc/3_6.md)
7. [Custom constraints](src/Resources/doc/3_7.md)
8. [Custom data transformers](src/Resources/doc/3_8.md)
9. [Checking the uniqueness of entities](src/Resources/doc/3_9.md)
10. [Form submit by Javasrcipt](src/Resources/doc/3_10.md)
11. [onValidate callback](src/Resources/doc/3_11.md)
12. [Run validation on custom event](Resources/doc/3_12.md)
13. [Collections validation](src/Resources/doc/3_13.md)

4 Local development
---------------------------------------------------

[](#4-local-development-)

### Requirements

[](#requirements)

- docker with docker-compose
- make

### Run application

[](#run-application)

```
docker-compose up -d --build
make install
# test form will be available at http://127.0.0.1:8080
```

### Run tests

[](#run-tests)

```
make tests
```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~148 days

Recently: every ~418 days

Total

28

Last Release

550d ago

Major Versions

v1.7.0 → 2.0.x-dev2024-11-15

PHP version history (4 changes)v1.0.0PHP &gt;=5.3.2

1.4.x-devPHP &gt;=5.5.9

1.7.x-devPHP &gt;=7.4

2.0.x-devPHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e3409c555d1e101617340d2ba982d26d5c28a2b1dbf10e7e19b8a07e6a7eed5?d=identicon)[TomasLudvik](/maintainers/TomasLudvik)

![](https://www.gravatar.com/avatar/7b125b646ceaeb5a2a859613c9dcc82d18493c9071c32ca2991543067c6bdc66?d=identicon)[grossmannmartin](/maintainers/grossmannmartin)

![](https://www.gravatar.com/avatar/8aee0045853dd983a2a4f291d2e21e7492e2d8c19d84cdb7a76dd16c3eb499f9?d=identicon)[rostislav.vitek@shopsys.com](/maintainers/rostislav.vitek@shopsys.com)

---

Top Contributors

[![66Ton99](https://avatars.githubusercontent.com/u/383739?v=4)](https://github.com/66Ton99 "66Ton99 (61 commits)")[![pesektomas](https://avatars.githubusercontent.com/u/1737966?v=4)](https://github.com/pesektomas "pesektomas (21 commits)")[![RobinDvorak](https://avatars.githubusercontent.com/u/7197178?v=4)](https://github.com/RobinDvorak "RobinDvorak (17 commits)")[![sustmi](https://avatars.githubusercontent.com/u/885946?v=4)](https://github.com/sustmi "sustmi (7 commits)")[![asentner](https://avatars.githubusercontent.com/u/2752040?v=4)](https://github.com/asentner "asentner (5 commits)")[![manuelj555](https://avatars.githubusercontent.com/u/1214013?v=4)](https://github.com/manuelj555 "manuelj555 (4 commits)")[![hanneskaeufler](https://avatars.githubusercontent.com/u/68024?v=4)](https://github.com/hanneskaeufler "hanneskaeufler (2 commits)")[![benr77](https://avatars.githubusercontent.com/u/2156742?v=4)](https://github.com/benr77 "benr77 (2 commits)")[![tools4origins](https://avatars.githubusercontent.com/u/8068386?v=4)](https://github.com/tools4origins "tools4origins (2 commits)")[![VaclavSir](https://avatars.githubusercontent.com/u/1473642?v=4)](https://github.com/VaclavSir "VaclavSir (1 commits)")[![akashgosai](https://avatars.githubusercontent.com/u/34570479?v=4)](https://github.com/akashgosai "akashgosai (1 commits)")[![conradkleinespel](https://avatars.githubusercontent.com/u/1234006?v=4)](https://github.com/conradkleinespel "conradkleinespel (1 commits)")[![em411](https://avatars.githubusercontent.com/u/7682404?v=4)](https://github.com/em411 "em411 (1 commits)")[![grossmannmartin](https://avatars.githubusercontent.com/u/1177414?v=4)](https://github.com/grossmannmartin "grossmannmartin (1 commits)")[![honzagula](https://avatars.githubusercontent.com/u/15079308?v=4)](https://github.com/honzagula "honzagula (1 commits)")[![maarekj](https://avatars.githubusercontent.com/u/1654977?v=4)](https://github.com/maarekj "maarekj (1 commits)")[![maryo](https://avatars.githubusercontent.com/u/900769?v=4)](https://github.com/maryo "maryo (1 commits)")[![ShopsysBot](https://avatars.githubusercontent.com/u/36038946?v=4)](https://github.com/ShopsysBot "ShopsysBot (1 commits)")

---

Tags

symfonyvalidationjavascriptform

### Embed Badge

![Health badge](/badges/shopsys-jsformvalidator-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/shopsys-jsformvalidator-bundle/health.svg)](https://phpackages.com/packages/shopsys-jsformvalidator-bundle)
```

###  Alternatives

[fp/jsformvalidator-bundle

Javascript validation for sf\[2|3|4\] forms.

132418.8k1](/packages/fp-jsformvalidator-bundle)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[apy/jsfv-bundle

Symfony2 Javascript Form Validation Bundle with localisation support

92770.5k](/packages/apy-jsfv-bundle)[barbieswimcrew/zip-code-validator

Constraint class for international zipcode validation

772.3M](/packages/barbieswimcrew-zip-code-validator)[karser/karser-recaptcha3-bundle

Google ReCAPTCHA v3 for Symfony

1862.4M7](/packages/karser-karser-recaptcha3-bundle)[boekkooi/jquery-validation-bundle

Jquery form validation bundle for symfony 2

2773.9k1](/packages/boekkooi-jquery-validation-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
