0

スタンプを配置する前に、ユーザーがダイアログで編集できるスタンプに 4 つの動的テキスト フィールド (Text1、Text2、Text3、Text4) を持つ動的な PDF-XChange スタンプを作成しようとしています。私が望むのは、ユーザーがスタンプを選択し、ダイアログ ポップアップが 4 つのユーザー入力フィールドで開くようにすることです。

  1. RMA ステータス - ステータスを追加するユーザー (RMAS という名前)
  2. ユーザーが自由に入力できるテキスト フィールド (FREE という名前)
  3. ユーザーの ID 情報 (TEAM という名前) から取得した、ユーザーの名前とビジネス チーム
  4. 今日の日付。後で何かをスタンプする場合に編集可能 (名前は DATE)

ユーザーに各質問を連続して尋ねるダイアログボックスを4回ポップアップする場所で動作させましたが、4つのテキストフィールドを持つ1つのダイアログボックスが要求されました。以下のコードを機能させるためにどのように変更する必要があるかを理解できないようですが、私はこれに非常に慣れていません。

現在、最後の質問 (日付) のみが開かれ、ダイアログがアクティブになる直前に私の JavaScript 日付コードによって取り込まれず、他の質問は開かれません。日付要素を削除すると、その前に質問 (名前とビジネス ユニット) が表示されますが、テスト済みのコードの最後で処理されたデータを使用して事前入力された 4 つの質問すべてを含むダイアログは表示されません。別々に働いています。

私のコードは以下にコメントされています。4 つのテキスト フィールドがあらかじめ入力された状態でダイアログを開くのを手伝ってくれる人がいるなら、どこが間違っていたのか知​​りたいです。そして、スタンプの Text1 から Text4 ボックスにデータを追加するのを手伝ってくれたら、大喜びです!

// Dialog Definition 
var oDlg = {
    
    RMAStatus: "",
    FreeText: "",
    NameAndUnit: "",
    TodaysDate: "",

    description:
    {
        name: "Stamp details",
        elements:
        [
            {
                type: "view",
                elements:
                [
                    {
                        type: "view",
                        elements:
                        [
                            {
                                item_id: "lbl1",
                                type: "static_text",
                                name: "&RMA Stage",
                            },
                            {
                                width: 200,
                                height: 22,
                                type: "edit_text",
                                item_id: "rmas",
                            }
                        ],
                        type: "view",
                        elements:
                        [
                            {
                                item_id: "lbl1",
                                type: "static_text",
                                name: "&Free text field",
                            },
                            {
                                width: 200,
                                height: 88,
                                type: "edit_text",
                                item_id: "free",
                            }
                        ],
                        type: "view",
                        elements:
                        [
                            {
                                item_id: "lbl1",
                                type: "static_text",
                                name: "&Your name and team",
                            },
                            {
                                width: 200,
                                height: 22,
                                type: "edit_text",
                                item_id: "team",
                            }
                        ],
                        type: "view",
                        elements:
                        [
                            {
                                item_id: "lbl1",
                                type: "static_text",
                                name: "&Stamp date",
                            },
                            {
                                width: 200,
                                height: 22,
                                type: "edit_text",
                                item_id: "date",
                            }
                        ]
                    },
                    {
                        type: "ok_cancel",
                    }
                ]
            }
        ]
    },
    initialize: function(dialog) { // where the data in dialog elements is set when the dialog is first activated
        dialog.load({
            "rmas":this.RMAStage,  
            "free":this.FreeText,
            "team":this.CorrectName,
            "date":this.todaysDate,
        });
    },
    commit: function(dialog) { // where element data is acquired when the user presses the OK button
        var data = dialog.store();
        this.RMAStage = data["rmas"];
        this.FreeText = data["free"];
        this.CorrectName = data["team"];
        this.todaysDate = data["date"];
    }
};

/*
 * Pre-fill the dialog text fields with the data below
 */
/* RMA STAGE (for RMAS to be populated) */
oDlg.RMAStage = "RMA Stage";

/* FREE TEXT FIELD (for FREE to be populated)  */
oDlg.FreeText = "";

/* NAME AND UNIT (for TEAM to be populated)  */
var IdentityName, IdentityNameSplit, Unit;

/* Set Organisation Unit */
Unit = "Parks & Landscapes Team";  // Unlikely to change

/* Find correctly formatted username from Identity info */
if((identity.name != null) && !/^\s*$/.test(identity.name))
    IdentityName = identity.name;
else
    IdentityName = identity.loginName.replace(/\./g," ").replace(/\./g," ").replace(/\b(\w)/g,function(Word,cFst){return cFst.toUpperCase()});

if (IdentityName.indexOf(', ') > -1) { // If the result is "Surname, Firstname" swap the names to make "Firstname Surname"
    IdentityNameSplit = IdentityName.split(', ');
    oDlg.NameAndUnit = IdentityNameSplit[1] + " " + IdentityNameSplit[0] + ", " + Unit;
}
else
    oDlg.NameAndUnit = IdentityName + ", " + Unit;

/* FORMATTED DATE FIELD (for DATE to be populated)  */
var stampDate;
stampDate = new Date();
oDlg.TodaysDate = util.printd("dd mmmm, yyyy", stampDate);

// Start dialog function
app.execDialog (oDlg);
4

1 に答える 1