Yii 1.1.13 Trim Error

I added trim filter in model




array('name','unique'),

array('name','filter','filter'=>'trim'),



In form

When i gave this type of input " yii " [space in front], The below error is occured

Error:

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘Visitors’ for key ‘name’. The SQL statement executed was: INSERT INTO visitors_type (name, isactive) VALUES (:yp0, :yp1)

Unique validator doesn’t work, because it must be declared after filter.

Check this: http://www.yiiframework.com/forum/index.php/topic/16432-how-to-trim-a-field-for-a-model/page__view__findpost__p__83031

Thank you