Свойство |
Тип |
Описание |
|
$compareAttribute |
|
the name of the attribute to be compared with. When both this property
and [[compareValue]] are set, the latter takes precedence. If neither is set,
it assumes the comparison is against another attribute whose name is formed by
appending '_repeat' to the attribute being validated. For example, if 'password' is
being validated, then the attribute to be compared would be 'password_repeat'. |
|
$compareValue |
|
the constant value to be compared with. When both this property
and [[compareAttribute]] are set, this property takes precedence. |
|
$message |
|
the user-defined error message. It may contain the following placeholders which
will be replaced accordingly by the validator:
- {attribute}: the label of the attribute being validated
- {value}: the value of the attribute being validated
- {compareValue}: the value or the attribute label to be compared with
- {compareAttribute}: the label of the attribute to be compared with
- {compareValueOrAttribute}: the value or the attribute label to be compared with |
|
$operator |
|
the operator for comparison. The following operators are supported:
- ==: check if two values are equal. The comparison is done is non-strict mode.
- ===: check if two values are equal. The comparison is done is strict mode.
- !=: check if two values are NOT equal. The comparison is done is non-strict mode.
- !==: check if two values are NOT equal. The comparison is done is strict mode.
- >: check if value being validated is greater than the value being compared with.
- >=: check if value being validated is greater than or equal to the value being compared with.
- <: check if value being validated is less than the value being compared with.
- <=: check if value being validated is less than or equal to the value being compared with.
When you want to compare numbers, make sure to also set [[type]] to number. |
|
$type |
|
the type of the values being compared. The follow types are supported:
- [[TYPE_STRING|string]]: the values are being compared as strings. No conversion will be done before comparison.
- [[TYPE_NUMBER|number]]: the values are being compared as numbers. String values will be converted into numbers before comparison. |
|