title: Check value of textbox is blank or not when form submit using yii framework
body: <p>I am new in yii framework.I am doing a search search operation using yii framework.My requirement is to check textbox value is null or not in the controller.I can print the textbox value in a variable '$experience'.but i cant check it is blank or not.controler name Sitecontroller.php,view search.php and model job.php</p>
  
  <p>My controller is Sitecontroller.php</p>
  
  <pre><code>&lt;?php
   class SiteController extends Controller
   {
   public function actionsearch()
    {
     $user_id = trim($_GET['id']);  
     $model = new Job ;
     if(isset($_POST['Job']))
        {
          if(Yii::app()-&gt;getRequest()-&gt;getIsAjaxRequest())
            {
              echo CActiveForm::validate(array($jobProfileM2)); 
              Yii::app()-&gt;end(); 
            }
            $model-&gt;attributes=$_POST['Job'];
            if($model-&gt;validate())
             {
               $title=$_POST['Job']['title'];
               $experience=$_POST['Job']['experience'];
               echo "data".$experience=trim($experience);
               if($_POST['Job']['experience'] == " ")
               {
                  echo "hai";
               }
    $model=Job::model()-&gt;findAll(array('select'=&gt;'*',"condition"=&gt;"(title like '%$title%')
    or   (key_skills like '%$title%')",));
               $number=count($model);
  //$this-&gt;redirect($this-&gt;createUrl('site/search_result',array('title'=&gt;$title,)));  
             }
             else
             {
               Yii::app()-&gt;user-&gt;setFlash('error', "Validation failed!");
             }                                 
      }
     $this-&gt;render('search',array('model' =&gt;$model));
   }
   }
    ?&gt;
  </code></pre>
  
  <p>//view-search.php</p>
  
  <pre><code>&lt;div class="form"&gt;
    &lt;?php $form=$this-&gt;beginWidget('CActiveForm', array(
  'id'=&gt;'login-form',
  'enableClientValidation'=&gt;false,
  'htmlOptions' =&gt; array(),
      'clientOptions'=&gt;array(
      'validateOnSubmit'=&gt;true
  ),
   )); ?&gt;
    &lt;?php
  foreach(Yii::app()-&gt;user-&gt;getFlashes() as $key =&gt; $message) {
      echo '&lt;div class="flash-' . $key . '"&gt;' . $message . "&lt;/div&gt;\n";
     }
   ?&gt;
     &lt;div class="row"&gt;
     &lt;?php echo $form-&gt;labelEx($model,'Keyword'); ?&gt;
  
      &lt;?php echo $form-&gt;textField($model,'title'); ?&gt;
      &lt;?php echo $form-&gt;error($model,'Keyword'); ?&gt;
  &lt;/div&gt;
     &lt;div class="row"&gt;
     &lt;?php echo $form-&gt;labelEx($model,'Experience'); ?&gt;
      &lt;?php echo $form-&gt;textField($model,'experience'); ?&gt;
      &lt;?php echo $form-&gt;error($model,'experience'); ?&gt;
  &lt;/div&gt; 
  &lt;div class="row buttons"&gt;
      &lt;?php echo CHtml::submitButton('Search'); ?&gt;
  &lt;/div&gt;
     &lt;?php $this-&gt;endWidget(); ?&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>I cant print 'hai' message when experince textbox is blank.Anybody help me?</p>