George_Johnson wrote Also, note that that sample has a few problems with the sample code. There are 6 check boxes (3 with the same item_id), but the code only deals with 4 of them, so don't let that get in the way of understanding it. |
That actually is the biggest part of what confused me. It looked to me that somehow the script passed all data collectively out and I couldn't for the life of me understand why. This comment probably has helped me more than any. Thank you!
The following modifications to the script should help:
//Acrobat JavaScript Dialog
//Created by DialogDesigner from WindJack Solutions
var FormRouting =
{
result:"cancel",
DoDialog: function(){return app.execDialog(this);},
bChk1:false,
bChk2:false,
bChk3:false,
bChk4:false,
bChk5:false,
bChk6:false,
initialize: function(dialog)
{
var dlgInit =
{
"Chk1": this.bChk1,
"Chk2": this.bChk2,
"Chk3": this.bChk3,
"Chk4": this.bChk4,
"Chk5": this.bChk5,
"Chk6": this.bChk6
};
dialog.load(dlgInit);
},
commit: function(dialog)
{
var oRslt = dialog.store();
this.bChk1 = oRslt["Chk1"];
this.bChk2 = oRslt["Chk2"];
this.bChk3 = oRslt["Chk3"];
this.bChk4 = oRslt["Chk4"];
this.bChk5 = oRslt["Chk5"];
this.bChk6 = oRslt["Chk6"];
},
description:
{
name: "Form Routing",
elements:
[
{
type: "view",
elements:
[
{
type: "view",
char_height: 10,
elements:
[
{
type: "static_text",
item_id: "stat",
name: "Route Form To:",
char_width: 15,
alignment: "align_fill",
font: "dialog",
},
{
type: "view",
char_width: 8,
char_height: 8,
align_children: "align_top",
elements:
[
{
type: "view",
char_width: 8,
char_height: 8,
elements:
[
{
type: "check_box",
item_id: "Chk1",
name: "Marketing",
},
{
type: "check_box",
item_id: "Chk2",
name: "Sales",
},
{
type: "check_box",
item_id: "Chk3",
name: "Accounting",
},
]
},
{
type: "view",
char_width: 8,
char_height: 8,
elements:
[
{
type: "check_box",
item_id: "Chk4",
name: "Engineering",
},
{
type: "check_box",
item_id: "Chk5",
name: "Division HQ",
},
{
type: "check_box",
item_id: "Chk6",
name: "Corporate",
},
]
},
]
},
]
},
{
type: "ok_cancel",
},
]
},
]
}
};
// Example Code
FormRouting.bChk1 = false;
FormRouting.bChk2 = false;
FormRouting.bChk3 = false;
FormRouting.bChk4 = false;
FormRouting.bChk5 = false;
FormRouting.bChk6 = false;
if("ok" == FormRouting.DoDialog())
{
console.println("Chk1:" + FormRouting.bChk1);
console.println("Chk2:" + FormRouting.bChk2);
console.println("Chk3:" + FormRouting.bChk3);
console.println("Chk4:" + FormRouting.bChk4);
console.println("Chk5:" + FormRouting.bChk5);
console.println("Chk6:" + FormRouting.bChk6);
}