Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Captcha In Yii Framework Don't Appear (Show)

$
0
0
what's wrong? Please help..

------Model--------

public $verifyCode;

public function rules()
{

return array(array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
);
}


public function attributeLabels()

{

return array('verifyCode'=>'Verification Code', );
}








--------Controller
public function actions(){
return array(

// captcha action renders the CAPTCHA image displayed on the user registration page

'captcha'=>array(

'class'=>'CCaptchaAction',

'backColor'=>0xFFFFFF,
),
);

}



public function accessRules()
{

return array(
array('allow', 'actions'=>array('create','update','captcha'),
'users'=>array('@'),),
);


}




-------------------View--------------

<?php $form=$this->beginWidget('CActiveForm', array(

'id'=>'project-form',

'enableAjaxValidation'=>false,
));
?>


<?php if(CCaptcha::checkRequirements()): ?>

<div class="row">

<?php echo $form->labelEx($model,'verifyCode'); ?>

<div>

<?php $this->widget('CCaptcha'); ?>

<?php echo $form->textField($model,'verifyCode'); ?>

</div>

<div class="hint">Please enter the letters as they are shown in the image above.
<br/>Letters are not case-sensitive.</div>

<?php echo $form->error($model,'verifyCode'); ?>

</div>
<?php endif; ?>



<div class="row buttons">

<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>

</div>

<?php $this->endWidget(); ?>

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>