I want to disable or make readOnly a field when user will update, i.e. username
. When registered user update their information, they will see that username disable. I tried based on this answer but it does not work for me rather giving an error User has an invalid validation rule. The rule must specify attributes to be validated and the validator name.
I wrote in the rules:
array('username', 'readOnly'=>true, 'on'=>'update'),
and in the form:
echo $form->textFieldRow($model,'username',array(
'class'=>'span5',
'maxlength'=>45,
'readOnly'=>($model->scenario == 'update')? true : false
));
But do not understand why this shows error.