title: Yii Conditional Validation
body: <p>I have a question about Yii validation. I have a dropdown whose options are Y and N. If the user select Y the user must explain why he chose Y hence a textArea box will become required.</p>
  
  <p>My code for the rule looks at follows.</p>
  
  <p><code>array('explain', 'check', 'trigger'=&gt;'med_effects'),</code></p>
  
  <p>Check is my function used for validation</p>
  
  <pre><code>public function check($attribute, $params)
      {
          if($this-&gt;$params['trigger'] == 0 &amp;&amp; $this-&gt;$attribute == '') {
              $this-&gt;addError($attribute, 'Explain the effects of the medicine');
          }
      }
  </code></pre>
  
  <p>The value for <code>$this-&gt;$params['trigger']</code> does not change. I'm assuming because the saved value was 0(Y) and does not change even if the user choose N. How am I supposed to determine which option the user chose when he sumbits the form?</p>
  
  <p>Thanks.</p>