Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li><p>You cannot toggle the jQuery Validate plugin on/off for the form or for individual field elements. There is no method or workaround for this.</p></li> <li><p>The <code>ignore</code> option is set within the <code>.validate()</code> call, which is a "one-time" initialization of the plugin, so you cannot change or toggle options dynamically. Any subsequent calls to <code>.validate()</code> are always ignored.</p></li> </ul> <p>After initializing the plugin with <code>.validate()</code>, your only solution would be to use the <code>.rules()</code> method to dynamically <code>'add'</code> and <code>'remove'</code> rules for individual field elements. Don't be fooled by the <code>'add'</code> terminology... this method also allows you to overwrite existing rules, so you don't necessarily have to <code>'remove'</code> them first.</p> <p>To dynamically set the field as <code>required</code>:</p> <pre><code>$('#myfield').rules('add', { required: true // set a new rule }); </code></pre> <p>To dynamically set the field as <strong>not</strong> <code>required</code>:</p> <pre><code>$('#myfield').rules('add', { required: false // overwrite an existing rule }); </code></pre> <p>OR</p> <pre><code>$('#myfield').rules('remove', 'required'); // removes only specified rule(s) </code></pre> <p>OR</p> <pre><code>$('#myfield').rules('remove'); // removes all rules for this field </code></pre> <p><strong>Documentation</strong>: <a href="http://jqueryvalidation.org/rules/" rel="noreferrer">http://jqueryvalidation.org/rules/</a></p>
    singulars
    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