2
Follows the code:
$(document).ready(function () {
$("#myform").validate({
ignore: ":hidden",
rules: {
images: { required: true, extension: "jpg"},
messages: {
images: Arquivo inválido}
},
submitHandler: function (form) {
ajax - post ....
}
}
}
Html:
<input type="file" id="image_preview" class="form-control" name="images" accept="image/*">
I use this bootstrap fileinput
After choosing an image, I get error:
Uncaught Typeerror: Cannot read Property 'call' of Undefined. Exception occurred when checking element image_preview, check the 'Extension' method.
If I leave only "{ required: true}"
it works as the required field. With the extension type does not work.
Some solution ?
Could be the jQuery Validate version. Downloaded from their website ?
– Diego Souza
Downloaded by Manage nuget Packages
– Matheus Miranda
You added the
jquery.validate.methods
on the page after thejquery.validate
?– Diego Souza
I can’t find that name
jquery.validate.methods
in my script folder. Detail, downloaded straight from nuget.– Matheus Miranda