User model :
public function rules() {
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('name', 'length', 'max' => 128),
array('email', 'length', 'max' => 255),
array('password', 'length', 'max' => 40),
array('status, group_id', 'length', 'max' => 45),
array('id, name, email, password, status, group_id, username', 'safe', 'on' => 'search'),
array('name', 'length', 'max' => 32, 'min' => 6),
array('email', 'unique'),
array('email', 'email'),
array('verifyCode', 'captcha', 'allowEmpty' => !extension_loaded('gd')), //<-- this is validate Captcha remove it?
);
}
end user form:
<?php
/* @var $this UserController */
/* @var $model User */
/* @var $form CActiveForm */
?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'user-form',
'enableAjaxValidation'=>false,
)); ?>
<p class="note">Pola z<span class="required">*</span> muszą być wypełnione.</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'name'); ?>
<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>128)); ?>
<?php echo $form->error($model,'name'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'email'); ?>
<?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>255)); ?>
<?php echo $form->error($model,'email'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password',array('size'=>40,'maxlength'=>40)); ?>
<?php echo $form->error($model,'password'); ?>
</div>
<div class="row">
<?php //echo $form->labelEx($model,'status'); ?>
<?php echo $form->HiddenField($model,'status',array('size'=>45,'maxlength'=>45)); ?>
<?php echo $form->error($model,'status'); ?>
</div>
<div class="row">
<?php //echo $form->labelEx($model,'group_id'); ?>
<?php echo $form->HiddenField($model,'group_id',array('size'=>45,'maxlength'=>45)); ?>
<?php echo $form->error($model,'group_id'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->