title: Yii. How to add css "error" class to input on form submit?
body: <p>I have Yii form. Some fields are required. When form is submitted i need that CSS class "error" would be added to the text input. My Code:</p>
  
  <pre><code>          &lt;?php $form=$this-&gt;beginWidget('CActiveForm', array(
                      'id'=&gt;'contact-form',
                      'enableClientValidation'=&gt;true,
                      'clientOptions'=&gt;array(
                              'validateOnSubmit'=&gt;true,
                      ),
              )); ?&gt;
             &lt;ul class="contact_form"&gt;
                 &lt;li class="row"&gt;
                     &lt;?php echo $form-&gt;labelEx($model,'name'); ?&gt;
                     &lt;?php echo $form-&gt;textField($model,'name', array('class'=&gt;'input')); ?&gt;
                     &lt;?php echo $form-&gt;error($model,'name'); ?&gt;
                 &lt;/li&gt;
  ...
  </code></pre>
  
  <p>Now i just get div with error message:</p>
  
  <pre><code>&lt;div class="errorMessage" id="ContactForm_name_em_" style=""&gt;Laukelis „Vardas, pavardė“ negali būti tuščias.&lt;/div&gt;
  </code></pre>
  
  <p>How to add "error" class to input field?</p>