日期:2014-05-17 浏览次数:20777 次
$("#jixiaokaopingForm").validationEngine({
ajaxSubmit: true, //是否ajax提交
beforeSubmit:function(){
var dateType = $('input:radio[name="dateType"]:checked').val();
var year=$('#year').val();
var season=$('#season').val();
var month=$('#month').val();
if(dateType=="seasons"){
month='';
}else if(dateType=="years"){
season='';
month='';
}else if(dateType=="months"){
season='';
}
$.ajax({
url : encodeURI("${ctx}/deptcaseCount/deptcaseCount.do?method=check&year="
+ year + "&month=" + month+"&season="+season+"&flag=${flag}"),
type : 'POST',
dataType : "html",
success : function(data) {
if (data == 'false') {
alert('已存在同样时间段的记录,确认新增请找到该记录,进行修改再提交!');
document.getElementById("flag").value ="F";
}else{
document.getElementById("flag").value ="T";
}
}
});
var flag=document.getElementById("flag").value;
return flag=='T';
}
,
ajaxSubmitFile: encodeURI("${ctx}/deptcaseCount/deptcaseCount.do?method=save&flag=${flag}"),//ajax提交的url
afterSubmit:function(){
alert("${successful}");
var c = parent.document.frames[0].document;
var reload = c.getElementById("reload");
if('null'!=reload&&null!=reload&&'undifined'!=reload){
reload.click();
$(window.parent.document).find("div[name='deptcaseCounts']").deleteitem("tab_li_${deptcaseCount.uuid}");
}
location.reload();
}
})
var flag=document.getElementById("flag").value;
return flag=='T';
上面以前用变量获取到flag的值
这里直接返回
return flag;