mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-19 07:07:58 +08:00
docs/guide-ja updated [ci skip] (#11537)
* docs/guide-ja translations updated [skip ci] * docs/guide-ja security-* updated [ci skip]
This commit is contained in:
committed by
Carsten Brandt
parent
2eb90f82fe
commit
e96f956f8a
@@ -90,6 +90,27 @@ public function rules()
|
||||
|
||||
属性は、上記の検証のステップに従って、`scenarios()` でアクティブな属性であると宣言されており、かつ、`rules()` で宣言された一つまたは複数のアクティブな規則と関連付けられている場合に、また、その場合に限って、検証されます。
|
||||
|
||||
> Note: 規則に名前を付けると便利です。すなわち、
|
||||
> ```php
|
||||
> public function rules()
|
||||
> {
|
||||
> return [
|
||||
> // ...
|
||||
> 'password' => [['password'], 'string', 'max' => 60],
|
||||
> ];
|
||||
> }
|
||||
> ```
|
||||
>
|
||||
> これを子のモデルで使うことが出来ます。
|
||||
>
|
||||
> ```php
|
||||
> public function rules()
|
||||
> {
|
||||
> $rules = parent::rules();
|
||||
> unset($rules['password']);
|
||||
> return $rules;
|
||||
> }
|
||||
|
||||
|
||||
### エラーメッセージをカスタマイズする <span id="customizing-error-messages"></span>
|
||||
|
||||
@@ -526,6 +547,9 @@ JS;
|
||||
> ]
|
||||
> ```
|
||||
|
||||
> Tip: クライアント側の検証を手動で操作する必要がある場合、すなわち、動的にフィールドを追加したり、何か特殊な UI ロジックを実装する場合は、
|
||||
> Yii 2.0 Cookbook の [Working with ActiveForm via JavaScript](https://github.com/samdark/yii2-cookbook/blob/master/book/forms-activeform-js.md) を参照してください。
|
||||
|
||||
### Deferred 検証 <span id="deferred-validation"></span>
|
||||
|
||||
非同期のクライアント側の検証をサポートする必要がある場合は、[Defered オブジェクト](http://api.jquery.com/category/deferred-object/) を作成することが出来ます。
|
||||
|
||||
Reference in New Issue
Block a user