//submit
$('#formInfo1').submit(function(){
if(!submitCheck()){
return false;
}
try{
var formInfo = document.all('formInfo1');
if(Validator.Validate(formInfo,1)){
if(postUrl == "new"){
$('#formInfo1').ajaxSubmit(ajaxOptionsNew);
}else {
$('#formInfo1').ajaxSubmit(ajaxOptionsEdit);
}
}
}catch(e){alert('submit:'+e.message);}
return false;
});
var ajaxOptionsEdit = {
beforeSubmit : showRequest,
success : showResponse,
url : "flowcharSet!toUpdateProcessField.action",
error : function(XMLResponse) {
//alert(XMLResponse.responseText);
alert('操作失败!');
document.all('formInfo1').reset();
parent.queryForm.submit();
closeDialogInIframe();
}
};
var ajaxOptionsNew = {
beforeSubmit : showRequest,
success : showResponse,
url : "flowcharSet!addProcessInfo.action",
error : function(XMLResponse) {
//alert(XMLResponse.responseText);
alert('操作失败!');
document.all('formInfo1').reset();
parent.queryForm.submit();
closeDialogInIframe();
}
};
function showRequest() {
setBufftonDisabled(true);
return true;
}
function showResponse(responseText) {
try{
setBufftonDisabled(false);
if(responseText == '<%=DataStaticConstants.SUCCESS_MESSAGE%>'){
alert('操作成功!');
document.all('formInfo1').reset();
parent.getProcessInfo();
closeDialogInIframe();
}else{
alert('操作失败!');
}
}catch(e){alert(e.message);}
}
function setBufftonDisabled(flag) {
var inputs = document.getElementsByTagName("input");
for ( var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "button" || inputs[i].type == "submit") {
inputs[i].disabled = flag;
}
}
}
注意~~~!!!一定要看页面里面控件的name不要重复了!