簡體   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