Javascript so close to working...
I found the script below on this site and I would like to get it working for me to see if it's what I'm trying to accomplish. I have it attached to an mouseUp action of a button and it pops out a window. I click to open a file and click OK and that's all it does. No opens any file. Would someone take a look at this script and show me what's wrong or what's not right? I sure would appreciate it. I just wanna see it, I feel it's so close to working. Thanks, folks.
The script:
var docType
var Dlg ={
description:
{
name: "Select File To Open",
elements:
[
{
type: "view",
elements:
[
{
item_id: "Hdr1",
name: "Select File To Open",
type: "static_text",
},
{
item_id: "Btn1",
name: "File1",
type: "radio",
group_id: "rdgp",
},
{
item_id: "Btn2",
name: "File2",
type: "radio",
group_id: "rdgp",
},
{
item_id: "Btn3",
name: "File3",
type: "radio",
group_id: "rdgp",
},
{
item_id: "Btn4",
name: "File4",
type: "radio",
group_id: "rdgp",
}
]
},
{
type: "ok_cancel",
ok_name: "Open"
},
]
}
};
commit:function (dialog) { // called when OK pressed
var results = dialog.store();
if (results["Btn1"]) docType = 1;
else if (results["Btn2"]) docType = 2;
else if (results["Btn3"]) docType = 3;
else if (results["Btn4"]) docType = 4;
}
app.execDialog(Dlg);
if(docType==1){
app.openDoc("File1", this);
}
else if(docType==2){
app.openDoc("File2", this);
}
else if(docType==3){
app.openDoc("File3", this);
}
else if(docType==4){
app.openDoc("File4", this);
}
