EReCaptchaValidator is a validator which uses reCAPTCHAto validate a CAPTCHA rendered by the EReCaptcha widget.
You need to have valid public and private keys for this to work. You can get them by registering yourself at http://recaptcha.net/
Current version: 1.3
Downloads
Requirements
- Yii 1.1 or above
Installation
- Extract the release file under
protected/extensions
Installation
- Extract the release file under
protected/extensions
Usage
In the view:
echo CHtml::activeLabel($model, 'validacion'); <?php $this->widget('application.extensions.recaptcha.EReCaptcha', array('model'=>$model, 'attribute'=>'validacion', 'theme'=>'red', 'language'=>'en_E', 'publicKey'=>'<your public key>')) <?php echo CHtml::error($model, 'validacion');
In the model:
public function rules() { return array( ... array( 'validacion', 'application.extensions.recaptcha.EReCaptchaValidator', 'privateKey'=> '<your private key>', 'on' => 'registerwcaptcha' ), ... ); }
public function attributeLabels() { return array( 'validacion'=>Yii::t('demo', 'Enter both words separated by a space: '), ); }
In the Controller:
public function actionRegister() { $model= new User(); $model->scenario = 'registerwcaptcha'; ... if($model->validate()) { // and here is the actual HACKY part $model->scenario = NULL; // save user registration $model->save(); } }


