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