title: Multi-select requiring minimum 2 selections with jquery chosen and validate plugins
body: <p>I have 2 drop down menus.  The first has the options of "single month" and "multiple months".  If single month is selected, the second drop down is not visible, which is the desired behavior. This is the first select: </p>
  
  <pre><code>&lt;select name="catFrequency" class="cst-mar" id="catFrequency"&gt;
        &lt;option value="0"&gt;single month only&lt;/option&gt;
        &lt;option value="1"&gt;multiple months&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>If the first drop down has the "multiple months" option selected, the second drop down appears (a chosen multi-select), allowing the user to select multiple months:</p>
  
  <pre><code> &lt;select multiple name="monthSelect" id="monthSelect" value="Select Month"&gt;
     &lt;option value='01'&gt;January&lt;/option&gt;
     &lt;option value='02'&gt;February&lt;/option&gt;
     &lt;option value='03'&gt;March&lt;/option&gt;
     &lt;option value='04'&gt;April&lt;/option&gt;
     &lt;option value='05'&gt;May&lt;/option&gt;
     &lt;option value='06'&gt;June&lt;/option&gt;
     &lt;option value='07'&gt;July&lt;/option&gt;
     &lt;option value='08'&gt;August&lt;/option&gt;
     &lt;option value='09'&gt;September&lt;/option&gt;
     &lt;option value='10'&gt;October&lt;/option&gt;
     &lt;option value='11'&gt;November&lt;/option&gt;
     &lt;option value='12'&gt;December&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I'm using the jquery validate plugin, I want to validate that if the first drop down value = 1 (multiple months), then require at least 2 months be selected from the month select menu.</p>
  
  <p>I have tried various things to accomplish this, but haven't had much luck.  I also read that the validate plugin ignores selects, so I've added the following bit to the settings based upon some other questions on SO.</p>
  
  <p><code>ignore: "hidden:not(select)",</code></p>
  
  <p><a href="http://jsfiddle.net/njxmht02/2/" rel="nofollow">Here's the fiddle</a></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Ok, I'm giving Jason Raines credit for the answer for pointing me in the right direction.  I used a variation of his answer and thought I'd post it here in case it could benefit someone else.  </p>
  
  <p>I used <a href="http://jqueryvalidation.org/jQuery.validator.addMethod/" rel="nofollow">validate.addMethod</a> to create a custom method.  </p>
  
  <pre><code>jQuery.validator.addMethod("minTwoMonths", function(value, element) {
      if($('#catFrequency').val() == '1') {
          var monthSelected = value;
          if(!monthSelected) {
              monthSelected = 0;
          }
          if(monthSelected.length &gt;= '2'){
              return true;
          } else {
              $('#submitCatEdit').addClass('button_disabled').attr('disabled', true);
              return false;
          }
      } else if($('#catFrequency').val() != '1') {
          return true;
      }
  }, "You must select at least 2 months in order to use an irregular category.");
  </code></pre>