PHP Класс yii\validators\RequiredValidator

С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends Validator
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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 - {requiredValue}: the value of [[requiredValue]]
$requiredValue the desired value that the attribute must have. If this is null, the validator will validate that the specified attribute is not empty. If this is set as a value that is not null, the validator will validate that the attribute has a value that is the same as this property value. Defaults to null.
$skipOnEmpty whether to skip this validator if the value being validated is empty.
$strict whether the comparison between the attribute value and [[requiredValue]] is strict. When this is true, both the values and types must match. Defaults to false, meaning only the values need to match. Note that when [[requiredValue]] is null, if this property is true, the validator will check if the attribute value is null; If this property is false, the validator will call [[isEmpty]] to check if the attribute value is empty.

Открытые методы

Метод Описание
clientValidateAttribute ( $model, $attribute, $view )
init ( )

Защищенные методы

Метод Описание
validateValue ( $value )

Описание методов

clientValidateAttribute() публичный Метод

public clientValidateAttribute ( $model, $attribute, $view )

init() публичный Метод

public init ( )

validateValue() защищенный Метод

protected validateValue ( $value )

Описание свойств

$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 - {requiredValue}: the value of [[requiredValue]]
public $message

$requiredValue публичное свойство

the desired value that the attribute must have. If this is null, the validator will validate that the specified attribute is not empty. If this is set as a value that is not null, the validator will validate that the attribute has a value that is the same as this property value. Defaults to null.
См. также: strict
public $requiredValue

$skipOnEmpty публичное свойство

whether to skip this validator if the value being validated is empty.
public $skipOnEmpty

$strict публичное свойство

whether the comparison between the attribute value and [[requiredValue]] is strict. When this is true, both the values and types must match. Defaults to false, meaning only the values need to match. Note that when [[requiredValue]] is null, if this property is true, the validator will check if the attribute value is null; If this property is false, the validator will call [[isEmpty]] to check if the attribute value is empty.
public $strict