$(document).ready(function(){
//表单验证
$("#projForm").validate({
rules: {
fullName:{
required:true,
remote:{
type:"post",//数据请求方式
url: "${pageContext.request.contextPath}/sysprojbid/xxx.do?projId=${projId}",//异步验证路径
data:{
fullName:function(){
return $("#fullName").val();
},
},
dataType:"html",
dataFilter:function(data,type){//AJAX异步返回数据
var flag = eval("("+data+")");
if(flag){
return true;
}else{
return false;
}
}
}
} ,
projCode:{required:true, remote:"${pageContext.request.contextPath}/sysprojbid/projcodeunique.do?projId=${proj.projId}"},
remark: {maxlength:200}
},messages: {
fullName: {remote:"项目全称已经存在!"},
projCode: {remote:"项目编号已经存在!"}
}
});
//ajax提交
$("#projForm").ajaxForm({
dataType:"json",
success:function (data){
if(data.state == "success"){
$.messager.alert("提示", "保存成功", "info",function(){
try {
opener.searchResource();
opener.searchSub();
} catch (e) {} //刷新dataGrid页面
window.close();
});
}else{
$.messager.alert("错误", "保存失败", "error");
}
}
});
});
//表单验证
$("#projForm").validate({
rules: {
fullName:{
required:true,
remote:{
type:"post",//数据请求方式
url: "${pageContext.request.contextPath}/sysprojbid/xxx.do?projId=${projId}",//异步验证路径
data:{
fullName:function(){
return $("#fullName").val();
},
},
dataType:"html",
dataFilter:function(data,type){//AJAX异步返回数据
var flag = eval("("+data+")");
if(flag){
return true;
}else{
return false;
}
}
}
} ,
projCode:{required:true, remote:"${pageContext.request.contextPath}/sysprojbid/projcodeunique.do?projId=${proj.projId}"},
remark: {maxlength:200}
},messages: {
fullName: {remote:"项目全称已经存在!"},
projCode: {remote:"项目编号已经存在!"}
}
});
//ajax提交
$("#projForm").ajaxForm({
dataType:"json",
success:function (data){
if(data.state == "success"){
$.messager.alert("提示", "保存成功", "info",function(){
try {
opener.searchResource();
opener.searchSub();
} catch (e) {} //刷新dataGrid页面
window.close();
});
}else{
$.messager.alert("错误", "保存失败", "error");
}
}
});
});