Hi,
I encounter a problem when i use CCaptcha in my register module. when i input the correct captcha at first time, the validate can’t success, and then i change the captcha, it works. is this a bug of capcha? forward someelse answer!
Thanks!
this is the url of website: http://i.cntech.com.cn/user/register.html
I confige capture like this:
// captcha action renders the CAPTCHA image displayed on the contact page
'captcha'=>array(
'class'=>'CCaptchaAction',
'backColor'=>0xFFFFFF,
),
and follow is my code in register.php
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'register1-form',
'enableAjaxValidation'=>true,
)); ?>
<ul class="frm-group group1" id='registerform'>
<li class='field'>
<div class='input'>
<label>用户名:</label>
<?php echo $form->textField($register,'username',array('style'=>'width:300px;')); ?>
<p class='ok'></p>
</div><!--/input-->
<div class='msg show-attention'>
<?php echo $form->error($register,'username'); ?>
<p class='attention'>5-20个字符,一个汉字为3个字符,<br/>一旦注册成功,会员名不能修改
</p>
</div><!--/msg show-attention-->
</li>
<li class='field'>
<div class='input'>
<label>密 码:</label>
<?php echo $form->passwordField($register,'password',array('style'=>'width:300px;')); ?>
<p class='ok'></p>
</div><!--/input-->
<div class='msg show-attention'>
<?php echo $form->error($register,'password'); ?>
<p class='attention'>密码请使用6-20位英文、数字,为了你的密码安全,请使用英文和数字混合密码。
</p>
</div><!--/msg show-attention-->
</li>
<li class='field'>
<div class='input'>
<label>重复密码:</label>
<?php echo $form->passwordField($register,'password2',array('style'=>'width:300px;')); ?>
<p class='ok'></p>
</div><!--/input-->
<div class='msg show-attention'>
<?php echo $form->error($register,'password2'); ?>
<p class='attention'>请重复上面的密码,确保两次密码输入一致性。
</p>
</div><!--/msg show-attention-->
</li>
<li class='field'>
<div class='input'>
<label>Email:</label>
<?php echo $form->textField($register,'email',array('style'=>'width:300px;')); ?>
<p class='ok'></p>
</div><!--/input-->
<div class='msg show-attention'>
<?php echo $form->error($register,'email'); ?>
<p class='attention'>请确保Email地址的有效性,今后此Email将作为您找回密码获取服务的关键。
</p>
</div><!--/msg show-attention-->
</li>
<li class='field code-field'>
<div class='input'>
<label>验证码:</label>
<?php echo $form->textField($register,'verifyCode'); ?><?php $this->widget('CCaptcha'); ?>
</div><!--/input-->
<div class='msg show-attention'>
<?php echo $form->error($register,'verifyCode'); ?>
<p class='attention'>
请输入验证码!
</p>
</div><!--/msg show-attention-->
</li>
<li class='field submit-field'>
<div class='input'>
<?php echo CHtml::submitButton(Yii::t('register','提交'),array('class'=>'button')); ?>
</div><!--/input-->
</li>
</ul>
<?php $this->endWidget(); ?>