繁体   English   中英

Adobe acrobat Javascript Stamp中的默认文本

[英]default text in Adobe acrobat Javascript Stamp

嗨,大家好,我到过各种各样的地方,但无法弄清楚我要做什么,是将“ Attention To:”字段填充为默认文本,但可以选择替换它。 这是我的代码

  var dialog = {
    AtttoValue: "",
    LSDValue: "",
    AFEValue: "",
    MOCValue:"",
    AcccodeValue:"",
    PrintValue:"",

    commit:function (dialog) { /// called when OK pressed 
            var results = dialog.store();
            this.AtttoValue = results["txt1"];
            this.LSDValue = results["txt2"];
            this.AFEValue = results["txt3"];
            this.MOCValue = results["txt4"];
            this.AcccodeValue = results["txt5"];
            this.PrintValue = results["txt6"];
    },      

    description:
    {       
            name: "stamp Information",    // Dialog box title
            elements:
            [       
                    {       
                            type: "view", 
                            elements:
                            [       
                                    {       
                                            name: "Attention To:",
                                            type: "static_text",
                                    },      
                                    {       
                                            item_id: "txt1", 
                                            type: "edit_text",
                                            multiline: true,
                                            width: 200,
                                            height: 20
                                    },  
                                    {       
                                            name: "Enter LSD:",
                                            type: "static_text",
                                    },      
                                    {       
                                            item_id: "txt2", 
                                            type: "edit_text",
                                            multiline: true,
                                            width: 200,
                                            height: 20
                                    },    
                                    {       
                                            name: "Enter AFE / Cost Code:",
                                            type: "static_text",
                                    },      
                                    {       
                                            item_id: "txt3", 
                                            type: "edit_text",
                                            multiline: true,
                                            width: 200,
                                            height: 20
                                    },
                                    {       
                                            name: "Enter MOC#:",
                                            type: "static_text",
                                    },      
                                    {       
                                            item_id: "txt4", 
                                            type: "edit_text",
                                            multiline: true,
                                            width: 200,
                                            height: 20
                                   }, 
                                   {       
                                            name: "Enter Account Code:",
                                            type: "static_text",
                                    },      
                                    {       
                                            item_id: "txt5", 
                                            type: "edit_text",
                                            multiline: true,
                                            width: 200,
                                            height: 20
                                   }, 
                                     {       
                                            name: "Print Name:",
                                            type: "static_text",
                                    },      
                                      {       
                                            item_id: "txt6", 
                                            type: "edit_text",
                                            multiline: true,
                                            width: 200,
                                            height: 20
                                   },
                                    {       
                                            type: "ok_cancel",
                                            ok_name: "Ok",
                                            cancel_name: "Cancel"
                                    },      
                            ]       
                    },      
            ]       
    }       
}; 

if(event.source.forReal && (event.source.stampName ==         "#C6nQNxSFN0d4NCJMeJuYYA"))
{
 if ("ok" == app.execDialog(dialog))
{
;var cMsg = dialog.AtttoValue;
;event.value = "\n" + cMsg;
;event.source.source.info.afe = cMsg;

this.getField("LSD").value = "\n" + dialog.LSDValue;

this.getField("AFE").value = "\n" + dialog.AFEValue;

this.getField("MOC").value = "\n" + dialog.MOCValue;

this.getField("Acccode").value = "\n" + dialog.AcccodeValue;    

this.getField("Print").value = "\n" + dialog.PrintValue;


  }

}

谢谢任何帮助,将不胜感激

您需要向对话框对象添加一个初始化对象。 像这样...假设“ txt1”是您要填充的字段。

{
    initialize: function(dialog) {
        dialog.load({"txt1": "yourDefaultValue" });
    }
}

暂无
暂无

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

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