"Rules senario" gone with the wind?

I added senario to rules like this:




return array(

            array('username, password, password2, email', 'required','on'=>'register'),

}



It worded before, but after a while, strange thing happens:

1 if fields marked ‘requried’ is blank, the verification process will complain nothing. :blink:

2 if I remove ‘on’=>‘register’, the the verification works. :blink:

I am using yii_1.1.10. Any idea is welcome!

I found out the problem, I should define the senario like this in controller:


$model->scenario = 'register';

I didn’t define this before, and it worked…