Class CRequiredValidator
CRequiredValidator validates that the specified attribute does not have null or empty value.
When using theCValidator::$message
property to define a custom error message, the
message may contain additional placeholders that will be replaced with the
actual content. In addition to the "{attribute}" placeholder, recognized by all
validators (see CValidator
), CRequiredValidator allows for the following
placeholders to be specified:
- {value}: replaced with the desired value
CRequiredValidator::$requiredValue
.
- CComponent
- CValidator
- CRequiredValidator
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/validators/CRequiredValidator.php
protected
|
#
validateAttribute(
Validates the attribute of the object. If there is any error, the error message is added to the object. |
public
string
|
#
clientValidateAttribute(
Returns the JavaScript needed for performing client-side validation. |
addError(),
applyTo(),
createValidator(),
isEmpty(),
validate()
|
public
mixed
|
$requiredValue |
|
#
the desired value that the attribute must have. If this is null, the validator will validate that the specified attribute does not have null or empty value. 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. |
public
boolean
|
$strict | false |
#
whether the comparison to |
public
boolean
|
$trim | true |
#
whether the value should be trimmed with php trim() function when comparing strings. When set to false, the attribute value is not considered empty when it contains spaces. Defaults to true, meaning the value will be trimmed. |
$attributes,
$builtInValidators,
$enableClientValidation,
$except,
$message,
$on,
$safe,
$skipOnError
|