我刚刚将 jquery 插件下载到我的 grails 应用程序中。验证停止工作。我注意到,如果我删除我放入的内容,验证将起作用。
我放了gsp头
<g:javascript library="jquery" plugin="jquery"/>
配置文件
grails.views.javascript.library="jquery"
gsp正文中的调用验证
<g:javascript src="submit.js"/>
提交.js
$(function () {
$("#addDiseaseForm").validate({
errorPlacement: function (error, element) {
error.insertAfter(element);
},
rules: {
commonName: {
required: true
},
scientificName: {
required: true
},
imagedisease: {
required: true,
accept: "jpg|png|JPG|JPEG|PNG|GIF|gif|bmp|BMP"
},
imagesymptom: {
required: true,
accept: "jpg|png|JPG|JPEG|PNG|GIF|gif|bmp|BMP"
},
description: {
required: true
},
virus: {
required: true
},
spread: {
required: true
},
prevent: {
required: true
},
product:{
required : true
},
supplier:{
required : true
},
projectddl: {
required: true
}
}
});
});