<script src="js/jquery.validate.js" type="text/
javascript"></script>
<script type="text/javascript">
$().ready(function() {
$("#form1").validate({
rules: {
pno: {
required:true
},
<{if $project_type_permission == 1}>
project_type1:{
required:true
},
project_type2:{
required:true
},
project_type3:{
required:true
},
<{else}>
name: {
required:true
},
<{/if}>
priority:{
required:true
},
expected_finish_time:{
required:true
//dateISO:true
},
overdue_time:{
required:true
//dateISO:true
}
},
messages: {
pno:{
required:"请填写项目编号"
},
<{if $project_type_permission == 1}>
project_type1:{
required:"请选择客户"
},
project_type2:{
required:"请选择产品"
},
project_type3:{
required:"请选择<{$project_name3}>"
}, www.jb200.com
<{else}>
name:{
required:"请填写项目名称"
},
<{/if}>
priority:{
required:"请选择优先级"
},
expected_finish_time:{
required:"请输入预计完成时间"
//dateISO:"请输入正确预计完成时间"
},
overdue_time:{
required:"请输入需求超时时间"
//dateISO:"请输入正确需求超时时间"
}
},
errorPlacement: function(error, element) {
if(element.attr("name") == "expected_finish_time")
error.insertAfter("#expected_error");
else if(element.attr("name") == "overdue_time")
error.insertAfter("#overdue_error");
else
error.insertAfter(element);
}
});
});
</script>
<style type="text/css">
#form1 label.error {
color:#FF0000;
margin-left: 10px;
width: auto;
display: inline;
}
</style>