title: bootstrap 3 validator - change password form
body: <p>I have a bootstrap 3 form and I am using <a href="http://1000hz.github.io/bootstrap-validator" rel="nofollow noreferrer">validator</a> to validate forms.</p>
  
  <p>I have succesfully implemented basic validations for sign-in forms and now I am implementing validation of change password form.</p>
  
  <p>The form is as follows:</p>
  
  <pre><code>&lt;form id="changepassword-form" role="form" data-toggle="validator" class="form-quote" action="/changepasswordpost" method="POST"&gt;
    &lt;input name="changepassword-id" type="hidden" value="{{ id }}"/&gt;
    &lt;input name="changepassword-token" type="hidden" value="{{ token }}"/&gt;
    &lt;div class="form-group row"&gt;
      &lt;div class="form-field col-md-12 form-m-bttm"&gt;                                                                        
        &lt;input name="changepassword-password" type="password" placeholder="Nueva contraseña *" class="form-control required"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="form-group row"&gt;
      &lt;div class="form-field col-md-12 form-m-bttm"&gt;
        &lt;input name="changepassword-password2" type="password" placeholder="Repita la nueva contraseña *" class="form-control required"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;button id="changepassword-submit" type="submit" class="btn btn-primary"&gt;Cambiar contraseña&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I see in the documentation that custom validation can be used so I have written the following validation intended to be used in the second password field:</p>
  
  <pre><code>custom: {
    passwordmatch: function($el) {
      var matchValue = $('#changepassworde-password').value()
      if ($el.val() !== matchValue) {
        return "Passwords do not match"
      }
    }
  }
  </code></pre>
  
  <p>But I do not know where or how can I define this custom validation. I understand that once defined I should just apply <code>data-passwordmatch=''</code> to second password field.</p>