- 注册时间
- 2014-2-19
- 最后登录
- 2014-6-4
- 阅读权限
- 10
- 积分
- 69
- 精华
- 0
- 帖子
- 20
|
felt 发表于 2014-2-28 10:27
请提供重现问题的html页面,我们本地不能重现
function dialogManager(cfg) {
var title = cfg['title'] || "信息查看、编辑",
width = cfg['width'] || 600,
height = cfg['height'] || 400,
url=cfg['url'],
viewMode=cfg['viewMode'] || "browse",
loadUrl=cfg['loadUrl'],
saveUrl = cfg['saveUrl'],
formName=cfg['form'],
root=cfg["root"] || "data";
if (!url) throw "必须指定url参数。";
if (!loadUrl) throw "必须指定loadUrl参数。";
if (viewMode != "browse" && !saveUrl) throw "必须指定saveUrl参数。";
if (!formName) throw "必须指定form的值。";
var dlgId = null, formObj = null, miniForm = null;
var instance = this;
var saveAction = cfg['save'];
dialogManager.prototype.show = function () {
dlgId = mini.open({
url: url,
title: title,
width: width,
height: height,
allowResize: true,
allowDrag: true,
showCloseButton: true,
showMaxButton: true,
showModal: true,
onload: function () {
var iframe = this.getIFrameEl();
var xdocument = iframe.contentWindow.document
var xWindow = iframe.contentWindow;
try {
miniForm = new xWindow.mini.Form("#" + formName);
}
catch (e) {
try {
var fm = xdocument.getElementById(formName);
miniForm = new mini.Form(fm);
}
catch (e) {
miniForm = null;
}
}
finally {
var saveButton = xdocument.getElementById('saveAction');
if (saveButton != null && saveUrl != null) {
$(saveButton).removeAttr('onclick').click(instance.save);
}
}
if (!miniForm) {
mini.alert("无法获取到表单的引用,操作被中止。");
mini.hideMessageBox(dlgId);
return;
} else instance.loadForm();
}
});
}
dialogManager.prototype.loadForm= function() {
$.getJSON(loadUrl, {}, function (r, c) {
var data = r[root];
if(data)miniForm.setData(data);
});
}
dialogManager.prototype.save = function () {
miniForm.validate();
if (miniForm.isValid()) {
}
else {
var error = miniForm.getErrorTexts() || "";
if (error.length > 0) {
var ps ="由于存在已下错误:<br/>"+'<div style="color:red">'+ error.join('<br/>')+'</div>导致表单无法提交,请修复错误后再进行提交操作。';
mini.alert(ps,"系统管理");
}
}
}
}
贴图太烦了,只能把代码放上来。我用的IE11.0.9600.16518 |
|