如何使用 JavaScript 在 SAP Adob​​e Forms 中动态设置值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7479160/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 00:14:58  来源:igfitidea点击:

How do I set a value dynamically in SAP Adobe Forms using JavaScript

javascriptsapabaplivecycle-designeradobe-form

提问by Esti

I'm creating a form based on the SAP standard Adobe form F140_CUS_STAT_01.

我正在创建基于 SAP 标准 Adob​​e 表单 F140_CUS_STAT_01 的表单。

In the "Document" column I have the requirement to display field REBZG if it contains a value, or BELNR if not.

在“文档”列中,我要求显示字段 REBZG(如果它包含值),或者 BELNR(如果不包含)。

I have done the following:

我做了以下工作:

if ( data.CustomerStatement.ItemTable.TableOpenItem.REBZG.rawValue == null ||
     data.CustomerStatement.ItemTable.TableOpenItem.REBZG.rawValue == '' ) 
  {  data.CustomerStatement.ItemTable.TableOpenItem.REBZG.rawValue = 
     data.CustomerStatement.ItemTable.TableOpenItem.BELNR.rawValue; }

BELNR is a hidden field in TableOpenItem

BELNR 是 TableOpenItem 中的隐藏字段

Unfortunately nothing happens.

不幸的是什么也没有发生。

Is there something wrong with my syntax?; Should I be using a specific event? Do I have to treat the internal table fields differently?

我的语法有问题吗?我应该使用特定的事件吗?我是否必须以不同的方式对待内部表字段?

Also, how do I debug javascript in the SAP context. I have tried both "Alert" and print to console, but neither has any effect.

另外,如何在 SAP 上下文中调试 javascript。我已经尝试了“警报”和打印到控制台,但都没有任何效果。

回答by Alexander_P

To enable the JavaScript Debugger for LiveCycle Designer and execute code from the JavaScript Console, you must enable JavaScript and the JavaScript Debugger in Acrobat Professional. You need to enable the JavaScript Debugger to access the JavaScript Console because the console window is a component in the JavaScript Debugger interface.

要为 LiveCycle Designer 启用 JavaScript 调试器并从 JavaScript 控制台执行代码,您必须在 Acrobat Professional 中启用 JavaScript 和 JavaScript 调试器。您需要启用 JavaScript Debugger 才能访问 JavaScript Console,因为控制台窗口是 JavaScript Debugger 界面中的一个组件。

You can enable the JavaScript Debugger in Adobe Reader if you have LiveCycle Reader Extensions installed. To enable the JavaScript Debugger in Adobe Reader, you need to get the debugger.js file and then edit the Microsoft Windows Registry. For more information about enabling the JavaScript Debugger in Adobe Reader, see Developing Acrobat Applications Using JavaScript at partners.adobe.com/public/developer/acrobat/devcenter.html (English only). (from Help in Adobe designer) I hope it helpful..) Anyway you can use "this.isNull" instead of data.CustomerStatement.ItemTable.TableOpenItem.REBZG.rawValue == null And event.. usually I use event form:ready for such cases.

如果您安装了 LiveCycle Reader Extensions,则可以在 Adob​​e Reader 中启用 JavaScript 调试器。要在 Adob​​e Reader 中启用 JavaScript 调试器,您需要获取 debugger.js 文件,然后编辑 Microsoft Windows 注册表。有关在 Adob​​e Reader 中启用 JavaScript 调试器的详细信息,请参阅partners.adobe.com/public/developer/acrobat/devcenter.html(仅英文)上的使用 JavaScript 开发 Acrobat 应用程序。(来自 Adob​​e 设计器的帮助)我希望它有帮助..)无论如何你可以使用“this.isNull”而不是 data.CustomerStatement.ItemTable.TableOpenItem.REBZG.rawValue == null 和事件..通常我使用事件形式:就绪对于此类情况。