form validation problem

I am trying to make a search form at my companies action so I set this but even if I write something at the text field the validation does not pass what is wrong?

[edit] I use the Scenario companies, the named Scenarios use also the generic validation rules?If this how can I separate this Scenario?[/edit]

 class Companies extends CActiveRecord {....

public function rules() {

        return array(

 array('cmp_name','required', 'on'=>'companies'),.....


  public function safeAttributes() {

        return array(





public function actionCompanies() {


        $criteria=new CDbCriteria;

        $company=new Companies;

        if (isset($_POST['Companies'])) {



           print_r ($_POST['Companies']);

            if ($company->validate())

           { $criteria->condition='cmp_name like :postID';

            $criteria->params=array(':postID'=>"%". $company->cmp_name."%");

           print_r ($_POST['Companies']);


           else die();


Do you have a validation summary in your view?

I make another model.