PHP Class yii\captcha\CaptchaValidator

CaptchaValidator should be used together with CaptchaAction. Note that once CAPTCHA validation succeeds, a new CAPTCHA will be generated automatically. As a result, CAPTCHA validation should not be used in AJAX validation mode because it may fail the validation even if a user enters the same code as shown in the CAPTCHA image which is actually different from the latest CAPTCHA code.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\validators\Validator
Show file Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$captchaAction the route of the controller action that renders the CAPTCHA image.
$caseSensitive whether the comparison is case sensitive. Defaults to false.
$skipOnEmpty whether to skip this validator if the input is empty.

Public Methods

Method Description
clientValidateAttribute ( $model, $attribute, $view )
createCaptchaAction ( ) : CaptchaAction Creates the CAPTCHA action object from the route specified by [[captchaAction]].
init ( )

Protected Methods

Method Description
validateValue ( $value )

Method Details

clientValidateAttribute() public method

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

createCaptchaAction() public method

Creates the CAPTCHA action object from the route specified by [[captchaAction]].
public createCaptchaAction ( ) : CaptchaAction
return CaptchaAction the action object

init() public method

public init ( )

validateValue() protected method

protected validateValue ( $value )

Property Details

$captchaAction public property

the route of the controller action that renders the CAPTCHA image.
public $captchaAction

$caseSensitive public property

whether the comparison is case sensitive. Defaults to false.
public $caseSensitive

$skipOnEmpty public property

whether to skip this validator if the input is empty.
public $skipOnEmpty