In this famous jQuery plugin called Validate there's an option called 'onfocusout'. But I want to use another called 'onfocusin' which is not documented BUT exists inside the code AND the plugin's author cited it on a reply.
The code I've been trying:
<script type="text/javascript">
$(document).ready(function() {
$("form").validate({
onsubmit: false,
onkeyup: false,
onfocusin: true,
onfocusout: false,
rules: {
nome: {
required: true,
minlength: 5
}
}
})
})
</script>
</head>
<body>
<form action="tutorial.php" method="post" enctype="text/plain" >
<input type="text" name="nome" id="nome" />
<button type="submit">Submit</button>
</form>
</body>
And FireBug shows this error message when I 'focusin' the input:
validator.settings[eventType].call is not a function [Stop on this error]
validator.settings[eventType] && v...eventType].call(validator, this[0] );
jquery...date.js (line 305)
Now, the golden question: How can this be fixed?
Links:
Validate plugin:
bassistance.de/jquery-plugins/jquery-plugin-validation/
Validate documentation, options page:
docs.jquery.com/Plugins/Validation/validate#toptions
Validate plugin code:
ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js
Validate's author reply on abouth onfocusin:
groups.google.com/group/jquery-en/browse_thread/thread/652418e93c9618f1?pli=1
Instead of onfocusin: true, use this:
onfocusin: function(element) { $(element).valid(); }
I've had the same issue with this error validator.settings[eventType] && ...eventType].call(validator, this[0] );
If you want to use onfocusout use the same code:
onfocusout: function(element) { $(element).valid(); }
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With