Error form on update not display

Hi!

I have a problem with one of my model’s update. I have a realization table and a project table. A realization has multiple projects and I’m checking on a project update if the name of the project is not already taken by another project in the same realization. It works but when the name is not available, it doesn’t show the error on the form, it just does like everything went ok but doesn’t make any update on the project. So my check is working but I’d like the error to be displayed! I’ve done the same thing with other models and it works. So I don’t know what’s the problem for this one. Here’s the code, I’ve printed the model error and it’s ok, very weird!




public function rules()

	{

		// NOTE: you should only define rules for those attributes that

		// will receive user inputs.

		return array(

			array('name', 'isUnique', 'on'=>'insert'),

			array('name', 'isUniqueOnUpdate', 'on'=>'update'),

                ...

        }


	public function isUnique($attribute) {

		if(Project::model()->count('name=:name AND realisation_id=:realisation_id',

				array(':name'=>$this->name,':realisation_id'=>$this->realisation_id)) > 0) {

			$this->addError($attribute, "Name not available");

			//print_r($this->getError($attribute)); die;

		}

	}

	

	public function afterFind(){

		parent::afterFind();

		$this->previous_name = $this->name;

	}

	

	public function isUniqueOnUpdate($attribute, $params){

		if($this->previous_name !== null && $this->previous_name !== $this->name){

			$this->isUnique($attribute);

		}

	}



If someone knows what’s going on, let me know, thanks! :)

Last thing, on insert it works great.

Up please!