title: How to show a dropdown menu filter selected value after form is submitted?
body: <p>I am working on a search form which have a drop down menu filter. And the site is created by Yii.</p>
  
  <p>My filter form looks like this before it's submitted: <code>PIC 1</code>
  <img src="https://i.stack.imgur.com/DcCsD.jpg" alt="filter form"></p>
  
  <p>Form when I select the filters: <code>PIC 2</code>
  <img src="https://i.stack.imgur.com/m8xoa.jpg" alt="form while select the filters"></p>
  
  <p>But after I click the <code>filter</code> button it comes again like this: <code>PIC3</code>
  <img src="https://i.stack.imgur.com/44VLK.jpg" alt="after form is submitted"></p>
  
  <p>But I want the form should remain as <code>PIC 2</code> after I submit the form when it shows the results. </p>
  
  <p>My form is:</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div style="float: left"&gt;
          &lt;label class="form_controller required"&gt;By Brand&lt;/label&gt;
  
          &lt;select style="width: 148px;" id="select_options" name="SCDcustomer_contacts_cms[brand_select_option]"&gt;
              &lt;option value="none"&gt;Select an option&lt;/option&gt;
              &lt;option value="brand_preference"&gt;Brand Preference&lt;/option&gt;
              &lt;option value="brand_purchased"&gt;Brand Purchased&lt;/option&gt;
          &lt;/select&gt;
      &lt;/div&gt;
      &lt;div id="select_a_brand" name="select_a_brand"&gt; 
          &lt;?php echo $form-&gt;dropDownList($model,'brand_id', gGetBrandList('brand_id', 'brand_id, brand_name'), array('prompt'=&gt;'Select a brand')); ?&gt; 
      &lt;/div&gt;
  
      &lt;script type="text/javascript"&gt;
          $(document).ready(function(){
              jQuery('#select_a_brand').hide();
  
              $("#select_options").change(function(){
                  $( "select option:selected").each(function(){
  
                      if(($(this).attr("value")=="brand_preference") || ($(this).attr("value")=="brand_purchased") ){                                 
                          $("#select_a_brand").show();
                      }
  
                      if($(this).attr("value")=="none"){                                  
                          $("#select_a_brand").hide();
                      }
  
                  });
              });
          });
      &lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Rules function is:</p>
  
  <pre><code>public function rules()
      {
          return array(           
              array('scd_cust_id,cust_id,order_first_name,order_surname,order_email,order_postcode, brand_id, brand_select_option', 'safe', 'on'=&gt;'search'),
          );
      }
  </code></pre>
  
  <p>Form filter is :</p>
  
  <pre><code>if(!empty($filter)) {
      if ($this-&gt;brand_select_option == "brand_preference") {
                  $criteria-&gt;select .= ', COUNT(*) as brand_preference';              
                  $criteria-&gt;join .= ' INNER JOIN order_table ot ON ot.billing_contactid = t.contactid';
                  $criteria-&gt;join .= ' INNER JOIN order_item oi ON ot.scd_order_id = oi.scd_order_id';        
                  $criteria-&gt;join .= ' INNER JOIN johnanthony_rstest.product p ON p.product_id = oi.product_id';
                  $criteria-&gt;condition .= (!empty($criteria-&gt;condition) ? ' AND ' : '') . 'p.brand_id=:brand_id';
                  $criteria-&gt;group = 't.contactid';
                  $criteria-&gt;order = 'COUNT(*) DESC';
                  $criteria-&gt;params = array(':brand_id'=&gt;$this-&gt;brand_id);
                  $paging['pagination']['route']='report/index?SCDcustomer_contacts_cms[brand_id]=' . $this-&gt;brand_id;//For ajax pagination URL
              }
  
              if ($this-&gt;brand_select_option == "brand_purchased") {
                  $criteria-&gt;select .= ', SUM(product_price) AS brand_purchased';    
                  $criteria-&gt;join .= ' INNER JOIN order_table ot ON ot.billing_contactid = t.contactid';
                  $criteria-&gt;join .= ' INNER JOIN order_item oi ON ot.scd_order_id = oi.scd_order_id';  
                  $criteria-&gt;join .= ' INNER JOIN johnanthony_rstest.product p ON p.product_id = oi.product_id';
                  $criteria-&gt;condition .= (!empty($criteria-&gt;condition) ? ' AND ' : '') . 'p.brand_id=:brand_id';
                  $criteria-&gt;group = 't.contactid';
                  $criteria-&gt;order = 'SUM(product_price) DESC';
                  $criteria-&gt;params = array(':brand_id'=&gt;$this-&gt;brand_id);
                  $paging['pagination']['route']='report/index?SCDcustomer_contacts_cms[brand_id]=' . $this-&gt;brand_id;//For ajax pagination URL
              }
   }
  </code></pre>
  
  <p>Ajax file is:</p>
  
  <pre><code>if (!empty($model-&gt;brand_id) &amp;&amp; ($model-&gt;brand_select_option == "brand_preference")) {
      array_push($options['columns'], array(
          'name'=&gt;'brand_preference',
          'filter'=&gt;false,
          'header'=&gt;'Brand Preference (No of purchased items)',
          'type'=&gt;'raw',
          'value'=&gt;'$data-&gt;brand_preference',
  
      )); 
  }
  if (!empty($model-&gt;brand_id) &amp;&amp; ($model-&gt;brand_select_option == "brand_purchased")) {
      array_push($options['columns'], array(
          'name'=&gt;'brand_purchased',
          'filter'=&gt;false,
          'header'=&gt;'Brand Purchased (Sum of purchased items)',
          'type'=&gt;'raw',
          'value'=&gt;'$data-&gt;brand_purchased',
  
      )); 
  }
  </code></pre>