title: How to validate two text input, if one is filled, validation should ignore the other?
body: <p>I have a form that has text fields for the user to type one or more text field and proceed to search, two text fields are for ip address :</p>
  
  <p>IP Address
  External IP Address
  I am using the jquery validator, but when the user want to search for results that only match IP Addrese, the other field for External IP Address show validation error, ho to show the validation error only for the field of IP that was filled ?
  Here is what I have in the js file :</p>
  
  <pre><code>jQuery.validator.addMethod("ipAddressFormat",function(value, element){
  theName = "IPaddress";
  var ipPattern = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
  var ipArray = value.match(ipPattern);
  if (value == "0.0.0.0" || value == "255.255.255.255" || 
      value == "10.1.0.0" || value == "10.1.0.255" || ipArray == null)
      return false;
  else {
      for (i = 0; i &lt; 4; i++) {
          thisSegment = ipArray[i];
          if (thisSegment &gt; 254) {
              return false;                
          }
          if ((i == 0) &amp;&amp; (thisSegment &gt; 254)) {
              return false;
          }
      }
  }
  return true;   
  
  
  }, "Invalid IP Address");
  
  $(document).ready(function() {    
      $("#agentsSearchForm").validate({
          rules: {
              valueApiAddress: {
                  ipAddressFormat: true               
              }, 
              valueExternalApiAddress: {  
                  ipAddressFormat: true                
              },
              valuePort: {
                  range: [1, 65535]                
              }  
          },
           messages: {    
              valuePort: {
                  range: "Valid port range is 1 to 65535."
              }  
          }  
      });
  });
  </code></pre>
  
  <p>Thanks</p>