PHPackages                             innoweb/silverstripe-form-validation - 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. innoweb/silverstripe-form-validation

ActiveSilverstripe-vendormodule[Validation &amp; Sanitization](/categories/validation)

innoweb/silverstripe-form-validation
====================================

Adds Bouncer.js form validation to frontend forms.

3.0.0(7mo ago)35481BSD-3-ClauseJavaScript

Since May 1Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/xini/silverstripe-form-validation)[ Packagist](https://packagist.org/packages/innoweb/silverstripe-form-validation)[ RSS](/packages/innoweb-silverstripe-form-validation/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (20)Used By (0)

Bouncer.js Form Validation
==========================

[](#bouncerjs-form-validation)

[![Version](https://camo.githubusercontent.com/a1ffd4a744fa4f91b7045421e49ad4a65db267ffc54cbb5424bcd91e7053d9b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e6e6f7765622f73696c7665727374726970652d666f726d2d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/innoweb/silverstripe-form-validation)[![License](https://camo.githubusercontent.com/91eb504fb1a8659f9d526b28e72bdeecc1cb1ec8f83e936f8adb9603287be123/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696e6e6f7765622f73696c7665727374726970652d666f726d2d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](license.md)

Introduction
------------

[](#introduction)

Adds automatic form validation for frontend forms using the [Bouncer.js](https://github.com/cferdinandi/bouncer) library. This replaces the default HTML5 field validation to improve and unify the layout of error messages accross browsers.

This doesn't replace backend form validation. Backend validation should still be done using the default SS validator (e.g. RequiredFields).

It leaves [UserForms](https://github.com/silverstripe/silverstripe-userforms) forms alone as they are too heavily dependant on jQuery.

Requirements
------------

[](#requirements)

- SilverStripe ^6

Note: this version is compatible with Silverstripe 6. For Silverstripe 5, please see the [2 release line](https://github.com/xini/silverstripe-form-validation/tree/2).

Installation
------------

[](#installation)

Install the module using composer:

```
composer require innoweb/silverstripe-form-validation dev-master

```

Then run dev/build.

Configuration
-------------

[](#configuration)

No configuration required. By default, all frontend forms are being validated based on their HTML5 properties.

### Disable validation

[](#disable-validation)

If you want to exclude a form from validation, you can disable it in code:

```
$form = Form::create($controller, 'MyForm', $fields, $actions, $validator);
$form->disableFrontendValidation();
```

This add the class `js-no-validation` to the form tag.

To skip validation for specific buttons, you can add the class `skip-validation` to the button.

### Disable form submission

[](#disable-form-submission)

To disable the default form submission, you can disable it in code:

```
$form = Form::create($controller, 'MyForm', $fields, $actions, $validator);
$form->disableFormSubmission();
```

This adds the class `js-disable-submit` to the form tag.

This is useful if you want to submit the form via AJAX. To submit the form, you can listen to the `bouncerFormValid` event in JavaScript:

```
form.addEventListener('bouncerFormValid', function (event) {
	...
}, false);
```

### Add Custom Validators

[](#add-custom-validators)

You can inject custom JavaScript validators for certain fields. To do so, you need to extend `FormField` as follows:

```
SilverStripe\Forms\FormField:
  extensions:
    - Your\Custom\ValidationExtension
```

Use the `addCustomValidatorScripts` extension hook to inject your JavaScript validator:

```
class ValidationExtension extends Extension
{
    // needs to be run on base FormField class, otherwise it's not going to be loaded on time
    public function addCustomValidatorScripts() {
        Requirements::javascript(
            'your/custom/field-validation.js'
        );
    }
}
```

In your `field-validation.js` you need to add your validator definition to the global `bouncerValidators` variable:

```
window.bouncerValidators = window.bouncerValidators || {};

window.bouncerValidators.yourCustomValidator = {
	validator: function(field) {
		if (field.classList.contains('YourCustomField')) { // limit validator to your custom field type
			if (...) {
				// return true if field is NOT valid
				return true;
			}
		}
		// return false if field is valid!
		return false;
	},
	message: 'Please enter a valid value'
};
```

License
-------

[](#license)

BSD 3-Clause License, see [License](license.md)

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance62

Regular maintenance activity

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 85.3% of commits — single point of failure

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 ~109 days

Recently: every ~133 days

Total

19

Last Release

232d ago

Major Versions

1.4.2 → 2.0.02023-03-16

1.5.0 → 2.1.02023-09-27

2.x-dev → 3.0.02025-09-19

### Community

Maintainers

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

---

Top Contributors

[![xini](https://avatars.githubusercontent.com/u/1152403?v=4)](https://github.com/xini "xini (29 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

validationHTML5silverstripeformBouncer.js

### Embed Badge

![Health badge](/badges/innoweb-silverstripe-form-validation/health.svg)

```
[![Health](https://phpackages.com/badges/innoweb-silverstripe-form-validation/health.svg)](https://phpackages.com/packages/innoweb-silverstripe-form-validation)
```

###  Alternatives

[siriusphp/validation

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

181743.3k12](/packages/siriusphp-validation)[apy/jsfv-bundle

Symfony2 Javascript Form Validation Bundle with localisation support

92770.5k](/packages/apy-jsfv-bundle)[sheadawson/silverstripe-zenvalidator

Faster, easier client and server-side form validation for SilverStripe

5778.4k2](/packages/sheadawson-silverstripe-zenvalidator)[arondeparon/laravel-request-sanitizer

An easy to use request sanitizer that allows you to sanitize your form data before validating it.

112151.6k1](/packages/arondeparon-laravel-request-sanitizer)[progsmile/request-validator

Simple PHP Request Validator

33113.3k1](/packages/progsmile-request-validator)[stroker/form

ZF2 module for extending forms with live clientside validation

4157.1k](/packages/stroker-form)

PHPackages © 2026

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