Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set errorContainer in jQuery validation dynamically?
    primarykey
    data
    text
    <p>Can I dynamically set errorContainer in <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="nofollow noreferrer">jQuery validation</a>, which means showing different error container base on the button clicked. </p> <p>This is what I am trying to do, but seems doesn't work:</p> <pre><code> $('#b1').click(function(evt) { $('#form1').validate().resetForm(); validator.settings.errorContainer = $('#m1'); validator.settings.errorLabelContainer = $('ul', $('#m1')); ValidateAndSubmit(evt) if (evt.isDefaultPrevented()) return false; alert("b1 clicked"); }); $('#b2').click(function(evt) { $('#form1').validate().resetForm(); validator.settings.errorContainer = $('#m2'); validator.settings.errorLabelContainer = $('ul', $('#m2')); ValidateAndSubmit(evt); if (evt.isDefaultPrevented()) return false; alert("b2 clicked"); }); </code></pre> <p>the reason I'm doing this, because I'm using asp.net webform all my module inside one form tag, so I can't define another form inside existing form and set validation for each form, and I can only have one validation bind to the form. </p> <p>I am using encosia's solution to simulate validation group using jQuery validation for sub-form under one form tag which is working perfectly, but in some case sub-forms under different tabs, so I want to showing the error container in each tab.</p> <p>I have created a simple sample to explain what i'm trying to do <a href="http://dl.dropbox.com/u/2358165/test/validation/validation.html" rel="nofollow noreferrer">sample here</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload