Hi, I have some problem with AjaxValidation - always send me ‘<labelName> cannot be blank’ for all forms even that in form is some characters.
There is some code:
View sample:
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'register-form',
'enableAjaxValidation'=>true,
'focus'=>array($model,'username'),
)); ?>
Controler sample:
public function actionRegister()
{
$model=new ValidateModel;
if(isset($_POST['ajax']) && $_POST['ajax']==='register-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
........
and rules in model…
...
public function rules()
{
return array(
array('username, password, password2, email, verifyCode', 'required'),
array('username','length','max'=>32, 'min'=>6),
array('password','length','max'=>64, 'min'=>6),
array('password2','length','max'=>64, 'min'=>6),
array('email','length','max'=>256),
array('ip','length','max'=>15),
array('session','length','max'=>32),
array('time', 'numerical', 'integerOnly'=>true),
array('username', 'filter', 'filter'=>'strtolower'),
array('password', 'compare', 'compareAttribute'=>'password2'),
array('email','email'),
array('username, email', 'unique'),
array('verifyCode', 'captcha', 'allowEmpty'=>!extension_loaded('gd')),
);
}
...
if You want more code tell me…
Any ideas? Thank you for help. Regards