I am studying the use of html5 data attributes to pass validation rules on jquery.validate as a stop interval until the plugin is updated with HTML5 support. I am using jquery 1.4.2, jquery.validate 1.7 and jquery.validate 2.1. In my HTML, I use code like this:
<input name="foo" type="text" data-validate="{required:true,digits:true}" />
In my jQuery, I do the following:
<script type="text/javascript">
$.metadata.setType ("html5");
$(function ()
{
$('#myForm').validate ({debug:true});
});
</script>
It just causes an error message, validator.methods [method] - undefined
I made metadata () for an element with a data validation attribute, and I got a named validate returned object with my attributes set in it, so I know that metadata finds the attribute and loads from it, but the validate plugin does not seem to handle it . If I go back to class = "{validate: {...}}" and comment out a line that sets metadata to use HTML 5, everything works as it should.
Am I doing something wrong, or is there a problem with validation and / or metadata plugins?
source
share