title: how to use jquery validation with jquery autocomplete in my code
body: <p>hi i am using codeigniter . i am using ajax <a href="http://www.devbridge.com/projects/autocomplete/jquery/" rel="nofollow noreferrer">autocomplete for jquery</a> and <a href="http://docs.jquery.com/Plugins/validation" rel="nofollow noreferrer">jquery validation plugin</a> </p>
  
  <p>there is input box called city </p>
  
  <pre><code>&lt;input type="text" class="city" name="city" value=""&gt;
  </code></pre>
  
  <p>i use autocomplete for this inputbox </p>
  
  <p>jquery code </p>
  
  <pre><code> var a = jq('.city').autocomplete({ 
      serviceUrl:"&lt;? echo $this-&gt;config-&gt;item('base_url'); ?&gt;home/auth/city_autocomplete",
   });
  </code></pre>
  
  <p>image of this </p>
  
  <p><img src="https://i.stack.imgur.com/zr6NU.png" alt="enter image description here"></p>
  
  <p>when i select a value from the drop down the jquery validation plugin gives an error , 'min length 3'.
  but the city name is greater than 3 charactors </p>
  
  <p>this is my validation plugin code </p>
  
  <pre><code>    var x=jq("#contactinfo").validate({
          rules: {
  
              city: {
                  required:{
                      depends: function(){
                                      return ((type == "Single Store &amp; Venue") || (type == "Chain Store &amp; Venue")|| (type == "Department Store"));
                               }
                          },
                  minlength: 3,
                  maxlength: 50                   
              },
         },
  
          messages: {
  
              city: {
                  required: "Enter City",
                  minlength: "min length 3"
              },
          }
      }); 
  </code></pre>
  
  <p>tihs is the error image </p>
  
  <p><img src="https://i.stack.imgur.com/WAWno.png" alt="enter image description here"></p>
  
  <p>why is this happening . how to avoid this , i tired soooooooooooo hard , about one week to figure out what is happening but couldn't . please help ..........................
  thank you verymuch .</p>
  
  <p>UPDATE </p>
  
  <p>this is city , state and zip code html . state and zipcode are the fields next to city field </p>
  
  <pre><code>                                &lt;div class="input-container"&gt;
                                          &lt;div class="catergory-title-c"&gt;
                                              &lt;span class="verdana12gray"&gt;&lt;/span&gt;
                                          &lt;/div&gt;
                                          &lt;div class="form-item"&gt;
                                              &lt;div class="catergory-inputs-b"&gt;
                                                  &lt;div class="input-small"&gt;
                                                  &lt;input
                                                     class="city clear-input"
                                                     id="textarea_small_1"
                                                     value="&lt;?php if(isset($city['value'])){  echo $city['value'] ; }else{echo $map['other']['CityName'];} ?&gt;"
                                                     type="text"
                                                     name="city"
                                                 /&gt;                       
  
                                                  &lt;/div&gt;
                                                  &lt;div class="input-small"&gt;
                                                          &lt;input
                                                                 class="state clear-input"
                                                                 id="textarea_small_2"
                                                                 value="&lt;?php if(isset($state['value'])){ echo $state['value'] ; } ?&gt;"
                                                                 type="text"
                                                                 name="state"
                                                             /&gt;                                                               
  
                                                  &lt;/div&gt;
                                                  &lt;div class="input-small"&gt;
                                                      &lt;input type="text" id="textarea_small_3" name="zip_code"
                                                          value="&lt;?php if(isset($zip_code['value'])){ echo $zip_code['value'] ; } ?&gt;" /&gt;
                                                  &lt;/div&gt;
  
                                              &lt;/div&gt;
                                          &lt;/div&gt;
                                          &lt;div class="clear-fix"&gt;&lt;/div&gt;
                                      &lt;/div&gt;
  </code></pre>