Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Validate, but only after initial submission
    primarykey
    data
    text
    <p>I am using the very nice bassistance validation plugin for all my form validation needs: <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="nofollow">http://bassistance.de/jquery-plugins/jquery-plugin-validation/</a></p> <p>A problem I encounter: error messages appear instantly, even when a user hasn't finished completing a field. As such: invalid e-mail appears until the user has finished typing.</p> <p>In the documentation <a href="http://docs.jquery.com/Plugins/Validation/validate#toptions" rel="nofollow">here</a>, one solution is to set the option <code>onkeyup</code> to <code>false</code> causing error messages to only appear onblur.</p> <p>However, in <strong>my setup</strong>, I encounter two additional issues (not solved by the solution above)</p> <ol> <li>Upon submitting an invalid form, error messages are not cleared when correcting them</li> <li>When the browser autofill function used, automatically filled out fields stay marked as erroneous.</li> </ol> <p>So, my initial question was: how can I make Bassistance validation fire only after the first submit AND with it's default settings from there on out?</p> <p>Here's my code:</p> <pre><code>if($('#contact_form').length) { $("#contact_form").validate({ rules: { first_name: { required: true }, last_name: { required: true }, message: { required: true }, telephone: { required: true }, email: { required: true, email: true }, email_again: { required: true, email: true, equalTo: "#email" }, norobot: { required:true, minlength:4, maxlength:4, number:true } } }); } </code></pre> <p>Please find the full JavaScript here: <a href="http://lad.chocolata.be/js/main.js" rel="nofollow">http://lad.chocolata.be/js/main.js</a></p> <p>Here is a working example with bug with <code>onkeyup</code> set to <code>false</code>: <a href="http://lad.chocolata.be/nl/contact" rel="nofollow">http://lad.chocolata.be/nl/contact</a></p> <p>After submitting the form with some invalid fields, the error messages do not clear upon correcting them. </p> <p>What am I missing?</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.
 

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