whatgoodisaroad / validity

Client-Side Validation for jQuery
http://whatgoodisaroad.github.io/validity/
132 stars 74 forks source link

adding 'options' section to $.validity.outputs.summary output option to ... #60

Closed kevintavera closed 10 years ago

kevintavera commented 10 years ago

...be able to define custom selectors for the validation output div, this helps with having two output containers on the same page for two different forms

Created this so that if you have two forms on a page and wanted two different summary boxes you could update like this:

  $("#loginForm").validity(function() {
       // standard output summary class nested inside of the current form element
        $.validity.outputs.summary.options.container= "#loginForm " + $.validity.outputs.summary.options.container;
        $("#login_email").require().match('email');
        $("#login_password").require();
    });
  $("#loginForm2").validity(function() {
        $.validity.outputs.summary.options.container= "#completely-new-container-not-nested-in-my-form";
        $("#login_email2").require().match('email');
        $("#login_password2").require();
    });
whatgoodisaroad commented 10 years ago

Nice work. Thanks!