PHPackages                             arillo/silverstripe-jqueryformvalidator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. arillo/silverstripe-jqueryformvalidator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arillo/silverstripe-jqueryformvalidator
=======================================

Adds jquery.validation functionality to silverstripe 3.0+ forms.

311JavaScript

Since Oct 30Pushed 12y ago11 watchersCompare

[ Source](https://github.com/arillo/silverstripe-jqueryformvalidator)[ Packagist](https://packagist.org/packages/arillo/silverstripe-jqueryformvalidator)[ RSS](/packages/arillo-silverstripe-jqueryformvalidator/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

JQueryValidation
================

[](#jqueryvalidation)

Adds jquery.validation functionality to silverstripe 3.0+ forms. Visit  for more information.

Usage
-----

[](#usage)

To make it work, make sure your page has jquery included. For sake of backward compartibilty for old browsers you also might load json2.js. Both files can be found in modulefolder/javascript/libs.

Start up validation on a form like this:

```
$form = new Form(
	$this,
	'Form',
	$fields,
	new FieldList(
		new FormAction(
			'FormHandler',
			'Submit'
		)
	),
	RequiredFields::create(....)
);

```

### JQueryValidation::create($form, $config)

[](#jqueryvalidationcreateform-config)

Expects a form and an optional config array, which overrides values from the base config. Take a look into JQueryValidation::$base\_config for available key / value pairs.

```
JQueryValidation::create(
	$form,
	array(
		'validator' => array(
			'errorElement' => 'div'
		)
		...
		..
		.
	)
);

```

### JQueryValidation-&gt;generate()

[](#jqueryvalidation-generate)

For automated creation use:

```
// This will inspect all form fields and add their validation methods.
// It also will add required checks provided by the form's RequiredFields.
JQueryValidation::create($form)->generate();

// It is also possible to provide custom error messages and behaviour through passing a config array like this:
JQueryValidation::create($form)->generate(array(
	'messages' => array(
		'CheckboxField_DATA' => array(
			'required' => 'Custom message'
		)
	)
));
// Expected hooks are messages, rules, groups.

```

### JQueryValidation-&gt;custom()

[](#jqueryvalidation-custom)

If you want to provide your own validation file you can use this:

```
JQueryValidation::create($form)->custom('path/to/your.js');

// It is also possible to provide information about which additional js files should be loaded, like this:
JQueryValidation::create($form)->custom(
	'path/to/your.js',
	array(
		'additionalMethods',	// load additional-methods.min.js
		'metadata',				// load jquery.metadata.js
		'moment',				// load moment.min.js
		'date'					// load date.js
	)
);

```

### Supported form fields

[](#supported-form-fields)

- CheckboxField
- ConfirmedPasswordField
- DropdownField
- DateField
- DatetimeField
- EmailField
- PasswordField
- OptionsetField
- NumericField
- UploadField
- TimeField
- TextareaField
- TextField

### Validation types jquery.validator ships

[](#validation-types-jqueryvalidator-ships)

Standard:

- required – Makes the element required.
- remote – Requests a resource to check the element for validity.
- minlength – Makes the element require a given minimum length.
- maxlength – Makes the element require a given maxmimum length.
- rangelength – Makes the element require a given value range.
- min – Makes the element require a given minimum.
- max – Makes the element require a given maximum.
- range – Makes the element require a given value range.
- email – Makes the element require a valid email
- url – Makes the element require a valid url
- date – Makes the element require a date.
- dateISO – Makes the element require an ISO date.
- number – Makes the element require a decimal number.
- digits – Makes the element require digits only.
- creditcard – Makes the element require a credit card number.
- equalTo – Requires the element to be the same as another one

Additional methods:

- accept – Makes a file upload accept only specified mime-types.
- extension – Makes the element require a certain file extension.
- phoneUS – Validate for valid US phone number.

See  for more info.

Some of this methods are automatically invoked if JQueryValidation-&gt;generate() is used. Extra functionality can be added by adding them into $custom parameter. The following example creates a field which validates for an url:

```
// adding a simple textfield to the field list
$fields->push(
	TextField::create(
		'URL',
		'Your website'
	)
);
...
..
.
// later, when starting the validation you can add url validtition to this field like this:
JQueryValidation::create($form)
	->generate(
		array(
			'messages' => array(
				'URL' => array(
					'url' => 'Please enter a valid url.' // add error message
				)
			),
			'rules' => array(
				'URL' => array(
					'url' => true // add url validation
				)
			)
		)
);

```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1391103?v=4)[bumbus](/maintainers/bumbus)[@bumbus](https://github.com/bumbus)

![](https://avatars.githubusercontent.com/u/1353931?v=4)[Nicolas Cusan](/maintainers/nicolas-cusan)[@nicolas-cusan](https://github.com/nicolas-cusan)

![](https://avatars.githubusercontent.com/u/942981?v=4)[banglashi](/maintainers/banglashi)[@banglashi](https://github.com/banglashi)

---

Top Contributors

[![bumbus](https://avatars.githubusercontent.com/u/1391103?v=4)](https://github.com/bumbus "bumbus (29 commits)")

### Embed Badge

![Health badge](/badges/arillo-silverstripe-jqueryformvalidator/health.svg)

```
[![Health](https://phpackages.com/badges/arillo-silverstripe-jqueryformvalidator/health.svg)](https://phpackages.com/packages/arillo-silverstripe-jqueryformvalidator)
```

###  Alternatives

[hafael/laraflake

Laravel Package based on Twitter Snowflake ID Generator (64 bit ID).

278.0k1](/packages/hafael-laraflake)[coldtrick/group_tools

Combines different group additions into one plugin

305.2k](/packages/coldtrick-group-tools)

PHPackages © 2026

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