title: Yii2 required validation on update
body: <p>I've Yii2 form containing form fields depending on action of page. Ex. Few fields appears when then action is <code>create</code> and few appears when action is <code>update</code>. I want to add required validation based on this scenario.</p>
  
  <p>Ex.</p>
  
  <pre><code>&lt;?= $form-&gt;field($model, 'unique_identifier')-&gt;textInput(['maxlength' =&gt; 45]) ?&gt;
  </code></pre>
  
  <p>I am showing this field only when <code>action =&gt; 'update'</code>.</p>
  
  <p>Now I want to add required validation for this and I tried this:</p>
  
  <pre><code>[['unique_identifier'], 'required', 'on' =&gt; 'update'],
  </code></pre>
  
  <p>But above validation not working. If I remove <code>on=&gt;update</code> then its validating on both create and update scenario.</p>
  
  <p>Any help would be appreciated.</p>