Fixes #8822, fixes #9298. Clientside validator docs enhancements.

This commit is contained in:
Nikola Kovacs
2015-08-10 10:21:11 +02:00
committed by Alexander Makarov
parent a0df32fd0e
commit 4c0bcaf12e
2 changed files with 13 additions and 3 deletions

View File

@ -135,7 +135,7 @@
name: undefined,
// the jQuery selector of the container of the input field
container: undefined,
// the jQuery selector of the input field under the context of the container
// the jQuery selector of the input field under the context of the form
input: undefined,
// the jQuery selector of the error tag under the context of the container
error: '.help-block',

View File

@ -156,7 +156,8 @@ class Validator extends Component
/**
* @var string a JavaScript function name whose return value determines whether this validator should be applied
* on the client side. The signature of the function should be `function (attribute, value)`, where
* `attribute` is the name of the attribute being validated and `value` the current value of the attribute.
* `attribute` is an object describing the attribute being validated (see [[clientValidateAttribute()]])
* and `value` the current value of the attribute.
*
* This property is mainly provided to support conditional validation on the client side.
* If this property is not set, this validator will be always applied on the client side.
@ -300,10 +301,19 @@ class Validator extends Component
*
* The following JavaScript variables are predefined and can be used in the validation code:
*
* - `attribute`: the name of the attribute being validated.
* - `attribute`: an object describing the the attribute being validated.
* - `value`: the value being validated.
* - `messages`: an array used to hold the validation error messages for the attribute.
* - `deferred`: an array used to hold deferred objects for asynchronous validation
* - `$form`: a jQuery object containing the form element
*
* The `attribute` object contains the following properties:
* - `id`: a unique ID identifying the attribute (e.g. "loginform-username") in the form
* - `name`: attribute name or expression (e.g. "[0]content" for tabular input)
* - `container`: the jQuery selector of the container of the input field
* - `input`: the jQuery selector of the input field under the context of the form
* - `error`: the jQuery selector of the error tag under the context of the container
* - `status`: status of the input field, 0: empty, not entered before, 1: validated, 2: pending validation, 3: validating
*
* @param \yii\base\Model $model the data model being validated
* @param string $attribute the name of the attribute to be validated.