ajax + model rules in yii-user ?


I have a pb when displaying my form in an ajax process

I’m working with yii-user module,

it works fine(= all required fields are required) when in a normal page load

but when called in ajax the form contains 2 models User and Profile

and the User fields required rules are being ignored somehow.

I spend the whole day turning it upside down and couldn’t find the key to the puzzle.

maybe some one has experienced this ?

my controller call : 

public function actionCreate()


		$model=new User;

		$profile=new Profile;

		if(user()->profile->canCreateMeeting && isset($_POST['User']))


			$model->attributes = $_POST['User'];

			$model->activkey = Yii::app()->controller->module->encrypting(microtime().$model->password);

			$model->status = User::STATUS_ACTIVE;//we concider User automatically active

			$model->createtime = time();

			$model->lastvisit = time();


			$profile->attributes = $_POST['Profile'];

			$profile->user_id = 0;



           if($model->validate() && $profile->validate()  ) {


				if( $model->save() ) {



					echo json_encode(array("result"=>true,"id"=>$model->primaryKey));



			} else {


			        $validate = CMap::mergeArray( $model->getErrors() , $profile->getErrors() );

        		    echo json_encode(array("result"=>false,"errors"=>$validate,'Uerror'=>count($model->getErrors()),'Perror'=>count($profile->getErrors())));












It was a user right issue

due to my use case

my mistake