天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

 找回密码
 注册成为天翎用户
查看: 709|回复: 1

模板表单不能获取参数

[复制链接]
tldxbai 发表于 2017-2-13 12:04:55 | 显示全部楼层 |阅读模式
一个普通表单上设计了一个操作按钮,跳转到对应的模板表单,实现预览功能。
期间需要参数传递,在模拟表单脚本中接收参数,试了Session和url两种方法都不行,发现模板表单脚本中$WEB.getParamsTable().getHttpRequest()都为null,后发现只能在模拟表单定义标签,“基本”-“是否可打开脚本”中才能获取$WEB.getParamsTable().getHttpRequest()。
请问什么原因?可能在模板表单内部获取参数?
 楼主| tldxbai 发表于 2017-2-13 12:54:10 | 显示全部楼层
进一步发现情况是这样。
如下$WEB.getParamsTable().getHttpRequest()为空:
var docid = getCurrentDocument();
var userid =getWebUser().getId();
var process = getDocumentProcess();
var formProcess = getFormProcess();
var mainform = formProcess.doViewByFormName("浏览记录",getApplication());
var doc = process.doNew(mainform, getWebUser(), createParamsTable());

var request = $WEB.getParamsTable().getHttpRequest();
println("========"+request+"===============");
var ipaddr = request.getSession().getAttribute("IpAddr");
println("========"+ipaddr+"===============");

doc.addStringItem("IP地址",ipaddr);//表单字段值
doc.setParent(getCurrentDocument().getId());//主表单的ID
process.doCreate(doc);

如下调整后,先获取$WEB.getParamsTable().getHttpRequest(),参数获取成功:
var request = $WEB.getParamsTable().getHttpRequest();
println("========"+request+"===============");
var ipaddr = request.getSession().getAttribute("IpAddr");
println("========"+ipaddr+"===============");

var docid = getCurrentDocument();
var userid =getWebUser().getId();
var process = getDocumentProcess();
var formProcess = getFormProcess();
var mainform = formProcess.doViewByFormName("浏览记录",getApplication());
var doc = process.doNew(mainform, getWebUser(), createParamsTable());

doc.addStringItem("IP地址",ipaddr);//表单字段值
doc.setParent(getCurrentDocument().getId());//主表单的ID
process.doCreate(doc);

能解释原因吗?

本版积分规则

QQ|手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-13 03:08

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表