Using Unique Validator On Formmodel

I would like using "unique validator" on "Form Model" for two task "create and update data". But when I update data, the field with unique then show error. I want the validator disable with itself data,and validator with new replace data.


class TypeForm extends CFormModel{

	public $name;

	public $slug;

	public $des;

	public $order = 10;

	public $active = Type::TYPE_ACTIVE;

	public $isNew = true; // if update set to false

	public function rules(){

		return array(

				array('name, slug, active','required'),


			array('slug','unique','className'=>'Type'),	//work on add new data, but update not working					

				array('des, order','safe'),



	public function onSaveForm(CEvent $event){

		$this->raiseEvent('onSaveForm', $event);


	public function saveForm(){

		$this->onSaveForm(new CEvent($this));

		$model = new Type;

		$model->attributes = $this->attributes;

		return $model->save(false);


	public function onUpdate(CEvent $event){

		$this->raiseEvent('onUpdate', $event);


	public function updateForm(){



and my form


/* @var $this TypeFormController */

/* @var $model TypeForm */

/* @var $form CActiveForm */


<div class="form">

	<?php $form=$this->beginWidget('CActiveForm', array(



)); ?>

	<p class="note">

		Fields with <span class="required">*</span> are required.


	<?php echo $form->errorSummary($model); ?>

	<div class="row">

		<?php echo $form->labelEx($model,'name'); ?>

		<?php echo $form->textField($model,'name',array("size"=>40));?>

		<?php echo $form->error($model,'name'); ?>


	<div class="row">

		<?php echo $form->labelEx($model,'slug'); ?>

		<?php echo $form->textField($model,'slug',array("size"=>40));?>

		<?php echo $form->error($model,'slug'); ?>


	<div class="row">

		<?php echo $form->labelEx($model,'active'); ?>

		<?php echo $form->dropDownList($model, 'active',


					""=>"choose once",




				) ?>

		<?php echo $form->error($model,'active'); ?>


	<div class="row">

		<?php echo $form->labelEx($model,'order'); ?>

		<?php echo $form->textField($model,'order',array("size"=>40));?>

		<?php echo $form->error($model,'order'); ?>


	<div class="row">

		<?php echo $form->labelEx($model,'des'); ?>

		<?php echo $form->textArea($model,'des',array("rows"=>10,"cols"=>50)); ?>

		<?php echo $form->error($model,'des'); ?>


	<div class="row buttons">

		<?php echo CHtml::submitButton($model->isNew?"New":"Update"); ?>

		<?php echo CHtml::resetButton("Clear"); ?>


	<?php $this->endWidget(); ?>


<!-- form -->

ps: I wouldn’t like use CActiveRecord

sr my bad english