Hello Yii Users!
I’m trying to verify the following behavior in yii-1.1.10.r3566:
When a validation is performed, the validated parameter is automatically added to ‘safe’ parameters and imported from the POST data (even though the scenario doesn’t list it as ‘safe’).
My scenario doesn’t include the ‘pass’ form field:
array('email, usr_name, pass_repeat', 'safe', 'on'=>'noPass'), //only this scenario
and yet I get an error from empty password in the form, when sending empty value:
array('email, usr_name, pass', 'required'), //ALL scenarios
I was expecting what would be validated is $model->pass, and yet it’s from $model->attributes = $_POST;
Of course I have set a scenario before importing the POST data:
$model->scenario='noPass'; //(usuwamy 'pass' z listy 'safe attributes'); if(isset($_POST['User'])) $model->attributes = $_POST['User'];
Is it a bug, or I am doing something wrong ?
Should I list ‘safe’ rules before listing validators in the rules() array (maybe it’s the order of array elements) ?
Thank you for any comments !