Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery validation onblur
    text
    copied!<p>I am trying to get the jQuery validation working on a webpage I am creating. I have about 6 different fieldsets that contain the page's details. I am using this as I am hiding and showing them give a better user experience.</p> <p>I have the plugin working as I want whenever I try submit the page and whenever I add a single character (when a textbox requires 2 or more characters) however I also want the validation to happen onblur. I want to inform my users straight away if they haven't met the validation condition so they can fix it straight away and don't have to come back.</p> <p>Can anyone tell me what I need to do I am using the * <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">http://bassistance.de/jquery-plugins/jquery-plugin-validation/</a> plugin.</p> <p>This is the jQuery code I have written so far:</p> <pre><code> $("#aspnetForm").validate({ rules: { &lt;%=txtFirstName.UniqueID %&gt;: { required: true, minlength: 2 } , &lt;%=txtSurname.UniqueID %&gt;: { required: true, minlength: 2 } , &lt;%=txtMobileNumber.UniqueID %&gt;: { required: true, minlength: 8 } , &lt;%=Email.UniqueID %&gt;: { required: true, email: true } , &lt;%=ddDay.UniqueID %&gt;: { required: true } , &lt;%=ddMonth.UniqueID %&gt;: { required: true } , &lt;%=ddYear.UniqueID %&gt;: { required: true } , &lt;%=txtHouseNumber.UniqueID %&gt;: { required: true, minlength:1 } , &lt;%=txtAddress1.UniqueID %&gt;: { required: true, minlength:5 } , &lt;%=txtCity.UniqueID %&gt;: { required: true, minlength:2 } , &lt;%=txtSuburb.UniqueID %&gt;: { required: true, minlength:2 } , &lt;%=txtPostCode.UniqueID %&gt;: { required: true, minlength:4, maxlength:4 } , &lt;%=UserName.UniqueID %&gt;: { required: true, minlength:4 } , &lt;%=Password.UniqueID %&gt;: { required: true, minlength:4 } , &lt;%=ConfirmPassword.UniqueID %&gt;: { equalTo: "ctl00$ctl00$cpMain$cpLeft$Password" } , &lt;%=chkTerms.UniqueID %&gt;: { required: true } }, messages: { &lt;%=txtFirstName.UniqueID %&gt;: { required: "Please enter your firstname", minlength: "Minimum length is 2 characters" }, &lt;%=txtSurname.UniqueID %&gt;: { required: "Please enter your lastname", minlength: "Minimum length is 2 characters" }, &lt;%=txtMobileNumber.UniqueID %&gt;: { required: "Please enter your mobile", minlength: "Minimum length is 8 characters" } , &lt;%=ddDay.UniqueID %&gt;: { required: "Please enter your date of birth" } , &lt;%=txtMobileNumber.UniqueID %&gt;: { required: "Please enter your date of birth" } , &lt;%=txtMobileNumber.UniqueID %&gt;: { required: "Please enter your date of birth" } , &lt;%=Email.UniqueID %&gt;: "Please enter a valid email" , &lt;%=txtHouseNumber.UniqueID %&gt;: { required: "Please enter your house number", minlength:"Please add at least 1 character" } , &lt;%=txtAddress1.UniqueID %&gt;: { required: "Please enter your address", minlength:"Please add at least 5 characters" } , &lt;%=txtCity.UniqueID %&gt;: { required: "Please enter your city", minlength:"Please add at least 2 characters" } , &lt;%=txtSuburb.UniqueID %&gt;: { required: "Please enter your city", minlength:"Please add at least 2 characters" } , &lt;%=txtPostCode.UniqueID %&gt;: { required: "Please enter your postcode", minlength:"Please add the 4 required characters", maxlength:"Only 4 characters are allowed" } , &lt;%=UserName.UniqueID %&gt;: { required: "Please enter your username", minlength: "Please add the 4 required characters" } , &lt;%=Password.UniqueID %&gt;: { required: "Please enter your password", minlength: "Please add the 4 required characters" } , &lt;%=ConfirmPassword.UniqueID %&gt;: { equalTo: "Passwords must match" } , &lt;%=chkTerms.UniqueID %&gt;: { required: "Please agree to the terms" } } }); </code></pre> <p><br /> Any tips?</p>
 

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