title: Validating Months / Years with jquery validate
body: <p>I am trying to link two form fields using jQuery validate. 
  The user can only enter up to 5 years, but this is spread over two inputs, months and years. </p>
  
  <p>I have worked out to the following how I feel it should come together :</p>
  
  <pre><code>$('#leform')validate({
  debug: true,
  rules: {
      years : {
          required : {
              depends: function(element) {
                    var x = ($('#years').val() == 5) &amp;&amp; ($('#months').val() == 0),
                        y = ($('#years').val() &lt; 5),
                        z = (x || y);
                         return z;
  
                  },
          number : true,
          max : 5,
          min : 0
  
          },
          months : {
              required : true,
              number : true,
              min: 0,  
              max: 11 
          }
   }
  });
  </code></pre>
  
  <p>The user can input, 3 years 6 months, no problem, but the issue lies when the user inputs 5 years, 4 months I cannot get the validation to fire.  Any ideas?</p>
  
  <p>-------- EDIT / SOLUTION ---------</p>
  
  <p>Sorry im a pretty new user (long time lurker) so had to edit the question to post the answer</p>
  
  <p>Ok so it turns out I was misinterpreting the spec, it looks like "required" is a boolean true or false.</p>
  
  <p>I extended the validation with the following :</p>
  
  <pre><code>jQuery.validator.addMethod("yearCount", function(value, element) {
     var x = ($('#years').val() == 5) &amp;&amp; ($('#months').val() == 0),
     y = ($('#years').val() &lt; 5),
     z = (x || y);
     return z;
  }, "blah blah blah");
  </code></pre>
  
  <p>and updated the rules as follows : </p>
  
  <pre><code>required : true,
  max : 5,
  min : 0,
  yearCount : true
  </code></pre>