0

大家好,我在各种地方都看过,但无法弄清楚我想要做的是让“注意:”字段填充默认文本,但可以选择替换它。这是我的代码

  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;


  }

}

感谢任何帮助将不胜感激

4

1 回答 1

0

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

{
    initialize: function(dialog) {
        dialog.load({"txt1": "yourDefaultValue" });
    }
}
于 2017-03-22T15:17:22.903 回答