Firebug reports:
[16:33:50.257] validator.settings[eventType].call is not a function @ http://localhost/~herokudev/h/js/libs/jquery-validation/jquery.validate.js:323
jquery-validation version 2.0.0pre. jquery version 1.7.1. Firefox 12.0.
<form action="/reg/step1" method="post" id="enteremail" style="padding: 2em">
<p><input type="text" placeholder="[email protected]" name="email" id="enteremailemail" required autofocus></p>
<p><input type="submit" class="btn btn-primary btn-large" value="Save"></p>
</form>
$(document).ready(function() {
console.log("ready");
$.validator.setDefaults({
debug: true
});
$("form#enteremail").validate({
onfocusout: true,
onsubmit: true,
/* http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation_methods */
rules: {
email: {
required: true,
email: true
},
}
});
});
Same with 1.9.0 and 1.8.1.
The following code is a super simple repro case.
<!doctype html>
<head>
<title></title>
</head>
<body>
<form action="/reg/step1" method="post" id="enteremail" style="padding: 2em">
<p><input type="text" placeholder="[email protected]" name="email" id="enteremailemail" ></p>
<p><input type="submit" class="btn btn-primary btn-large" value="Save"></p>
</form>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("form#enteremail").validate({onfocusout: true});
});
</script>
</body>
true isn't a valid value for onfocusout, it has to be a function. What are you trying to achive by setting it to true?
I get it now.
I was experimenting to enable validation on blur. I couldn't find documentation on the legal values of the parameter, but I did find documentation did show the parameter being set to false, so I concluded that true was also a legal value.
http://docs.jquery.com/Plugins/Validation/validate#options
It states that you can set this to "true" or "false"
Disables onblur validation.
$(".selector").validate({
onfocusout: false
})
In fact, I think there is a trouble in the doc, try this :
onfocusin: function(element) { $(element).valid(); }
onfocusout: function(element) { $(element).valid(); }
I've updated the documentation to state false, Function as the type for these options (no more Boolean) and removed the misleading Default: true.
Most helpful comment
In fact, I think there is a trouble in the doc, try this :
onfocusin: function(element) { $(element).valid(); }
onfocusout: function(element) { $(element).valid(); }