title: jquery validate plugin - validate only if one of the field is not blank
body: <p><img src="https://i.stack.imgur.com/J59Rg.png" alt="jquery validate plugin - validate  only if one of the field is not blank"></p>
  
  <p>I should be able to save the username without changing the password.and validate #frmMyprofile only if current password is not blank.How to do that?</p>
  
  <p><strong>Javascript Validation code:</strong></p>
  
  <pre><code>$('#frmMyProfile').validate({
          rules: {
              "user[current_password]": "required",
              "user[password]": {
                  required: true,
                  minlength: 6
              },
              "user[password_confirmation]": {
                  required: true,
                  minlength: 6,
                  equalTo: "#user_password"
              }
          },
          messages: {
              "user[current_password]": "Please enter your current password",
              "user[password]": {
                  required: "Please enter new password",
                  minlength: "Please enter at least 6 characters"
              },
              "user[password_confirmation]": {
                  required: "Please enter confirm password",
                  equalTo: "Please enter the same value as the new password."
              }
          }
  });
  </code></pre>
  
  <p><strong>HTML:</strong>
  I should be able to save only user name or only password or both.It should only validate if current password is not blank.</p>
  
  <pre><code>&lt;form accept-charset="UTF-8" action="/users" class="form-stacked" id="frmMyProfile" method="post" novalidate="novalidate"&gt;&lt;div style="margin:0;padding:0;display:inline"&gt;&lt;input name="utf8" type="hidden" value="✓"&gt;&lt;input name="_method" type="hidden" value="put"&gt;&lt;input name="authenticity_token" type="hidden""&gt;&lt;/div&gt;          &lt;div class="form-horizontal"&gt;
                    &lt;div class="form-row control-group"&gt;
                      &lt;div class="input"&gt;
                        &lt;label class="control-label" for="user_id"&gt;Email ID&lt;/label&gt;
                        &lt;div class="controls"&gt;
                          &lt;input disabled="disabled" type="email" value="test+1@gmail.com"&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-horizontal"&gt;
                    &lt;div class="form-row control-group"&gt;
                      &lt;div class="input"&gt;
                        &lt;label class="control-label" for="user_name"&gt;User Name&lt;/label&gt;
                        &lt;div class="controls"&gt;
                          &lt;input name="user[name]" type="text" value="test" class="valid"&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-horizontal"&gt;
                    &lt;div class="form-row control-group"&gt;
                      &lt;div class="input"&gt;
                        &lt;label class="control-label" for="user_current_password"&gt;Current Password&lt;/label&gt;
                        &lt;div class="controls"&gt;
                          &lt;input id="user_current_password" name="user[current_password]" size="30" type="password"&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-row control-group"&gt;
                      &lt;div class="input"&gt;
                        &lt;label class="control-label" for="user_password"&gt;New Password&lt;/label&gt;
                        &lt;div class="controls"&gt;
                          &lt;input id="user_password" name="user[password]" size="30" type="password"&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-row control-group"&gt;
                      &lt;div class="input"&gt;
                        &lt;label class="control-label" for="user_password_confirmation"&gt;Confirm Password&lt;/label&gt;
                        &lt;div class="controls"&gt;
                          &lt;input id="user_password_confirmation" name="user[password_confirmation]" size="30" type="password"&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-row control-group"&gt;
                      &lt;div class="input"&gt;
                        &lt;label&gt;&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class="controls"&gt;
                        &lt;input name="version" type="hidden" value="v2"&gt;
                        &lt;button class="btn btn-primary qbol-button-save" type="submit"&gt;Save&lt;/button&gt;
                        &lt;button class="btn qbol-button-clear" type="reset"&gt;Clear&lt;/button&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
        &lt;/form&gt;
  </code></pre>