Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery validation not working for all fields
    primarykey
    data
    text
    <p>I have a form with different filed set. On each step i validate the whole form with the rule that only visible elements on the form should be validated. I can see that on step one the validation works fine. But on step 2 only some of the fields are validated. Here is the definition of the form</p> <pre><code>&lt;form id="enquiryForm" action=""&gt; &lt;div id="fieldset1" style="display: block;"&gt; &lt;fieldset class="addingenq"&gt; &lt;legend&gt; &lt;h2&gt;Contact information&lt;/h2&gt; &lt;span class="steps"&gt;Step 1 of 3&lt;/span&gt; &lt;/legend&gt; &lt;p&gt; &lt;input type="text" id="firstname" name="first" value="" placeholder="First Name" required&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="text" id="lastname" name="last" value="" placeholder="Last Name" required&gt; &lt;/p&gt; &lt;p&gt; &lt;input id="step1" type="button" value="Next" onclick="javascript: completeStep1();"/&gt; &lt;/p&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;div id="fieldset2" style="display: none;"&gt; &lt;fieldset class="addingenq"&gt; &lt;legend&gt; &lt;h2&gt;Move information&lt;/h2&gt; &lt;span class="steps"&gt;Step 2 of 3&lt;/span&gt; &lt;/legend&gt; &lt;p&gt; &lt;input type="text" id="originCity" placeholder="Origin City" required&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="text" id="originCountry" placeholder="Origin Country" value="India" required&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="number" id="originZip" placeholder="Origin Zip(Optional)"&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="text" id="destinationCity" placeholder="Destination City" required&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="text" id="destinationCountry" value="India" placeholder="Destination Country" required&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="number" id="destinationZip" placeholder="Destination Zip(Optional)"&gt; &lt;/p&gt; &lt;p&gt; Moving Date &lt;input type="date" id="movingDate" name="movingDate" required&gt; &lt;/p&gt; &lt;p&gt; &lt;input id="back_step1" type="button" value="Back" onclick="javascript: moveStep(2, 1);"/&gt; &lt;input id="step2" type="button" value="Next" onclick="javascript: completeStep2();"/&gt; &lt;/p&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;div id="fieldset3" style="display: none;"&gt; &lt;fieldset class="addingenq"&gt; &lt;legend&gt; &lt;h2&gt;Moving Requirements&lt;/h2&gt; &lt;span class="steps"&gt;Step 3 of 3&lt;/span&gt; &lt;/legend&gt; &lt;span class="form-subhead"&gt;Item List&lt;/span&gt; &lt;p&gt; Packaging Material Rating &lt;input id="pmr" name="start" type="number" value="1" /&gt; &lt;/p&gt; &lt;p&gt; &lt;input id="back_step2" type="button" value="Back" onclick="javascript: moveStep(3, 2);"/&gt; &lt;input id="step3" type="button" value="Submit" onclick="javascript: completeStep3();"/&gt; &lt;/p&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>Here is the validation rule i am using</p> <pre><code> $("#enquiryForm").validate({ ignore : ":not(:visible)", rules : { originZip : { required : false, digits : true }, destinationZip : { required : false, digits : true } } }); </code></pre> <p>Now the problem is that in step 2 i see only origin city being validate and Nothing else. No element after "originCity" filed gets validated. Not even the fields with required tag. Am i missing anything. Can someone please help?</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.
    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