Class CBooleanValidator
CBooleanValidator validates that the attribute value is either CBooleanValidator::$trueValue
or CBooleanValidator::$falseValue
.
CValidator::$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
), CBooleanValidator allows for the following
placeholders to be specified:
- {true}: replaced with value representing the true status
CBooleanValidator::$trueValue
. - {false}: replaced with value representing the false status
CBooleanValidator::$falseValue
.
- CComponent
- CValidator
- CBooleanValidator
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Located at x2engine/framework/validators/CBooleanValidator.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
|
$trueValue | '1' |
#
the value representing true status. Defaults to '1'. |
public
mixed
|
$falseValue | '0' |
#
the value representing false status. Defaults to '0'. |
public
boolean
|
$strict | false |
#
whether the comparison to |
public
boolean
|
$allowEmpty | true |
#
whether the attribute value can be null or empty. Defaults to true, meaning that if the attribute is empty, it is considered valid. |
$attributes,
$builtInValidators,
$enableClientValidation,
$except,
$message,
$on,
$safe,
$skipOnError
|