Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery validate(); Only validate on click of one type of submit button
    primarykey
    data
    text
    <p>I have a quite perflexing problem that I have researched and come up blank;</p> <p><strong>Scenario:</strong> I have a form, with the jQuery bassistance.de's validate() plugin (<a href="http://docs.jquery.com/Plugins/Validation" rel="noreferrer">http://docs.jquery.com/Plugins/Validation</a>).</p> <p>Does the job on submit perfectly, however; I two types of submit button. </p> <p>One submits the form as usual, triggering my back-end validation and return errors or success.</p> <p>The other type, is to all intense and purposes a submit button to the browser, however it tells my back-end to add another section of inputs (ie, a repeating element for employment history.) I want the user to be able to add the repeating elements without having to complete the rest of the form first. So clicking the second type of submit I want to BYPASS the validate();</p> <p><strong>HTML:</strong></p> <pre><code>&lt;form method="post" action="" id="ApplicationForm" name="ApplicationForm"&gt; &lt;input id="job1" name="job1" class="required"/&gt; &lt;input type="submit" name="delete_job1" value="Delete" class="delete" /&gt; &lt;input id="job2" name="job2" class="required"/&gt; &lt;input type="submit" name="delete_job2" value="Delete" class="delete" /&gt; &lt;input type="submit" name="add_job" value="Add Job" class="add" /&gt; &lt;input type="submit" name="ApplicationForm" value="Save Details" class="submit" /&gt; &lt;/form&gt; </code></pre> <p>I have tried a listener for the true submit button below, but this just stops the validate all togerther;</p> <pre><code>$(document).ready(function() { var submitPress $(".submit").click(function() { submitPress = true; }); if (submitPress) { $('form#ApplicationForm').validate(); } }); </code></pre> <p>I guess this is because the validate(); listeners is setup on the initial loading of the page, not upon submit...</p> <p>Is there there a rule or setting for validate(); I am missing, that I could utilise, or even a good hack with good old fasioned JS.</p> <p>Muchos gratias who ever can help, i'm at my whits end.</p> <p>Yours Sincerely, Working Late, AGAIN , Developer</p>
    singulars
    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