2

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.

user982853
  • 2,470
  • 14
  • 55
  • 82
  • You should take a look there http://stackoverflow.com/questions/4622232/jquery-validation-onblur and there http://stackoverflow.com/questions/6592857/jquery-validator-only-validate-onblur-event-not-onchange – Adrien Schuler Feb 19 '12 at 18:46

2 Answers2

2
    <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.

user982853
  • 2,470
  • 14
  • 55
  • 82
0

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?

Nicola Peluchetti
  • 76,206
  • 31
  • 145
  • 192
  • the link you posted above is not validating on blur...? At least on my comp it is not. I am using firefox. – user982853 Feb 19 '12 at 18:50
  • @user982853 I mean the first form, to me it validates on blur (try inserting only one character in the first field and pressing tab) – Nicola Peluchetti Feb 19 '12 at 18:52
  • nope not working. I redownloaded everything and still not working. Also doesn't work when i just visit the jquery demo. – user982853 Feb 19 '12 at 19:03