繁体   English   中英

Livecycle(JavaScript)代码未按顺序运行

[英]Livecycle (JavaScript) code not running in order

下午好,

我正在使用JavaScript在Livecycle ES2中制作PDF表单。

我使用以下代码在“单击”事件中的窗体上创建了一个按钮(Lockbutton1),以使几个子窗体上的所有字段均为“只读”,然后在“另存为”框中提示用户。

FORM.Page1.LockButton1::click - (JavaScript, client)

// Lock all fields in subforms except for signature subforms

oTargetField = this.resolveNode("SubformTop");
    oTargetField.access = "readOnly";
oTargetField = this.resolveNode("SubfrmDEP");
    oTargetField.access = "readOnly";
oTargetField = this.resolveNode("SubfrmLN");
    oTargetField.access = "readOnly";
oTargetField = this.resolveNode("SubfrmLNR");
    oTargetField.access = "readOnly";
oTargetField = this.resolveNode("SubfrmDEPR");
    oTargetField.access = "readOnly";
oTargetField = this.resolveNode("SubfrmDEPRD");
    oTargetField.access = "readOnly";
oTargetField = this.resolveNode("SubfrmDEPRI");
    oTargetField.access = "readOnly";
oTargetField = this.resolveNode("SubfrmLNRD");
    oTargetField.access = "readOnly";
oTargetField = this.resolveNode("SubfrmLNRI");
    oTargetField.access = "readOnly";

// Hide other buttons and text

this.resolveNode("ResetButton1").presence = "invisible";
this.resolveNode("PrintButton1").presence = "invisible";
this.resolveNode("FormType").presence = "invisible";
this.resolveNode("$").presence = "invisible";
this.resolveNode("Splashtxt").presence = "invisible";

// Save the form
app.execMenuItem("SaveAs");

但是,当用户单击锁定按钮时,首先会提示用户“另存为”框,一旦保存了表单,其余代码便会启动,使子表单变为只读状态并隐藏按钮和文本。

我不明白为什么首先要启动的是“另存为”框,而这应该是代码中最后要启动的东西。

我需要按以下顺序工作的过程:

  1. 用户单击锁定按钮。
  2. 指定的子窗体更改为只读。
  3. 按钮和文本不可见。
  4. 系统提示用户“另存为”框。

任何人都知道发生了什么事以及如何解决?

问候,

一种

您的代码逻辑还可以。 检查所有节点的名称是否与LiveCycle中定义的名称相同。 参见下面的示例和结果:

代码样例

PDF结果

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM