PHPackages                             hgh/yii-jquery-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. hgh/yii-jquery-form-validation

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

hgh/yii-jquery-form-validation
==============================

Using this package you can validate inputs out of Yii model

02JavaScript

Since Jul 6Pushed 6y agoCompare

[ Source](https://github.com/H-Gh/Yii-jQuery-form-validation)[ Packagist](https://packagist.org/packages/hgh/yii-jquery-form-validation)[ RSS](/packages/hgh-yii-jquery-form-validation/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Yii-jQuery-form-validation
==========================

[](#yii-jquery-form-validation)

This plugin runs custom validations on custom fileds which are not in Yii model.

Usage
-----

[](#usage)

#### php

[](#php)

```

    echo Html::textInput("Model[model_attribute_1]", null, [
      "class" => "form-control",
      "id" => "model-model_attribute_1"
    ]);
  ?>

```

#### jQuery

[](#jquery)

```
  var $form = $('#form');
  $form.yiiValidator('add', {
        model: "model",
        attribute: "model_attribute_1",
        rules: // ...
    });
```

methods
-------

[](#methods)

#### add

[](#add)

```
var $form = $('#form');
$form.yiiValidator('add', {
  //...
});
```

Rules
-----

[](#rules)

Rules can be a single object or array of objects. ```
rules : {
  //...
}
rules : [
  {
    //...
  },
  {
    //...
  }
];
```

Each rule consists of two element :

```
  rule
  errorMessage

```

Rule can be selected from below list or be a function.

```
required
number
email
url

```

```
rule : function(value) {
  //...
}
```

Example
-------

[](#example)

```
var $form = $('#form');
$form.yiiValidator('add', {
        model: "model",
        attribute: "model_attribute_1",
        rules: [{
            rule: "required",
            errorMessage: "should fill"
        }]
    });
```

```
var $form = $('#form');
$form.yiiValidator('add', {
        model: "model",
        attribute: "model_attribute_2",
        rules: [
            {rule : "required", errorMessage : "should fill"},
            {
                rule: function (value) {
                    return value > 0 && value !== "";
                },
                errorMessage: "should more than zero!",
            }
        ]
    });
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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://www.gravatar.com/avatar/7873222f18ced9739dd54f5bcfa13a8d9738496d22b38ff35d9f4b5b84f3269b?d=identicon)[h.gh](/maintainers/h.gh)

---

Top Contributors

[![H-Gh](https://avatars.githubusercontent.com/u/32479577?v=4)](https://github.com/H-Gh "H-Gh (11 commits)")

---

Tags

jqueryyii-modelyii2yii2-assetyii2-framework

### Embed Badge

![Health badge](/badges/hgh-yii-jquery-form-validation/health.svg)

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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