1.写infopath自定义扩展控件的js:
//自定义infopath链接扩展控件(链接打开页面)参数说明:
//this:指向一个div的控件容器,扩展的控件,添加到这里面即可
//dataStoreCtrl:值存储控件
//extendConfig:表单里配置的扩展配置,字符串
// 1.(iframe打开)eg:{"btntitle":"查看","formid":"4e7bf8ca37814d3e889e6e6fecf21580","mode":"iframe"}
// 2.(弹出)eg:{"btntitle":"查看","formid":"4e7bf8ca37814d3e889e6e6fecf21580","mode":"show"}
function linkbtn(dataStoreCtrl, extendConfig) {
debugger
//是否禁用(一般是infopath条件样式或者infopath设定)
var isDisabled = 'true' == $(this).attr('disabled') || 'disabled' == $(this).attr('disabled');
// 是否只读
var isPrint = '1' === $(this).attr('esprint');
// 当前的值,也就是表单里存储的值
var curVal = isPrint ? $(this).attr('esdataval') : dataStoreCtrl.val();
var cfg = $.parseJSON(extendConfig);
if (curVal!=''){
if(cfg.mode=='iframe'){
var btn = $('<button type="button" class="btn btn-primary" onclick="$("iframe[esctrl=iframe]").attr('src','/Platform/UIV2/Form/ShowForm.html?publishId='+cfg.formid+'&eskeyvalue='+curVal+'&esprintview=true')">'+cfg.btntitle+'</button>');
this.append(btn);
}
else{
var btn = $('<button type="button" class="btn btn-primary" onclick="esPrintDialog(''+cfg.formid+'',''+curVal+'')">'+cfg.btntitle+'</button>');
this.append(btn);
}
}
}
2.在infopath里设定infopath自定义扩展控件
2.1(点击弹出):
2.2(iframe打开):
3.显示效果
3.1(弹出):
3.2(iframe显示):