Custom dialog initialisation help please...
Hi there,
I'm having trouble with passing the information returned from a app.browseForDoc within a custom dialog. The app.browseForDoc is assigned to a button, which triggers ok, however I'm encountering 'undefined' when I try to get the filename or file path of the file selected.
I think it's the way I'm initialising the variable used to store and return the info from the app.browseForDoc. I've tried initialising 'baseFile' in a few different ways but I'm still having problems.
Please can someone help me.
Thanks in advance.
Here's my code so far:
var oDlg = {
strName: "", initialize: function(dialog) {
dialog.load({"usnm":this.strName}, this.baseFile = ""); },
commit: function(dialog) {
var data = dialog.store();
this.strName = data[ "usnm"];
var baseFile = dialog.store();
this.baseFile = data[ "baseFile"];
},
butn: app.trustedFunction(function(dialog) {
app.beginPriv();
var baseFile = app.browseForDoc();
app.endPriv();
}),
description: { name: "Test Dialog", elements: [
{ type: "view", elements: [
{ type: "button", item_id: "butn", name: "Select 1st pdf"},
{ name: "Enter no. of files:", type: "static_text", },
{ item_id: "usnm", type: "edit_text", char_width: 15 },
{ type: "ok_cancel", },
] },
] }
};
// Dialog Activation
oDlg.strName = "765"; // Enter a default value of files to process
if( "ok" == app.execDialog(oDlg)) {
console.println("Number of files to process: " + oDlg.strName);
console.println("Selected base file: " + oDlg.baseFile);
}
