user982853
user982853

Reputation: 2488

JQuery Form Validation - Onblur

I have a form that uses jquery form validator: My question is how to i get the validation to trigger not just on submit but also on blur? I want it to validate each individual field on blur (not the entire form on blur because i don't want the errors displayed for fields they haven't yet scrolled down to).

I love this plug in if only i could get it to validate each field on blur. For long forms, i need the user to be be alerted before they fill out the entire form.

I am new to jquery and form validation so if someone knows how to fix this can you be specific on how and what files i need to edit in order to accomplish this. Thank you.

Upvotes: 2

Views: 3805

Answers (2)

user982853
user982853

Reputation: 2488

    <script type="text/javascript">
    jQuery().ready(function() {
       jQuery("#form").validate({
          onfocusout: function(element) { jQuery(element).valid(); } ,
});
})
     </script>

By adding this i got the onblur to work.

Upvotes: 2

Nicola Peluchetti
Nicola Peluchetti

Reputation: 76880

As you can see from the demo the validation does occur on blur (also on click and on submit). Are you sure that you didn't disable it?
Maybe you set the wrong options (scroll down to see the options) or you just didn't set-up validation in the right moment?

Upvotes: 0

Related Questions