I used JavaScript in LiveCycle to create a list containing 10 check boxes, but my script stops working after check box number 9! Can someone please review my code and tell me what I'm doing wrong? Thank you in advance.
----- form1.Conditions::docReady - (JavaScript, client)
//Fine-Restitution-Special Assessment
var FineRest =
{
result:"cancel",
DoDialog: function(){return app.execDialog(this);},
aChk1:false,
aChk2:false,
aChk3:false,
aChk4:false,
aChk5:false,
aChk6:false,
aChk7:false,
aChk8:false,
aChk9:false,
aChk10:false,
initialize: function(dialog)
{
var dlgInit =
{
"Chk1": this.aChk1,
"Chk2": this.aChk2,
"Chk3": this.aChk3,
"Chk4": this.aChk4,
"Chk5": this.aChk5,
"Chk6": this.aChk6,
"Chk7": this.aChk7,
"Chk8": this.aChk8,
"Chk9": this.aChk9,
"Chk10": this.aChk10,
};
dialog.load(dlgInit);
},
commit: function(dialog)
{
var oRslt = dialog.store();
this.aChk1 = oRslt["Chk1"];
this.aChk2 = oRslt["Chk2"];
this.aChk3 = oRslt["Chk3"];
this.aChk4 = oRslt["Chk4"];
this.aChk5 = oRslt["Chk5"];
this.aChk6 = oRslt["Chk6"];
this.aChk7 = oRslt["Chk7"];
this.aChk8 = oRslt["Chk8"];
this.aChk9 = oRslt["Chk9"];
this.aChk10 = oRslt["Chk10"];
},
description:
{
name: "SPECIAL CONDITIONS",
elements:
[
{
type: "view",
elements:
[
{
type: "static_text",
item_id: "static",
name: "SPECIAL CONDITIONS [select all that apply]:",
font: "dialog",
},
{
type: "check_box",
item_id: "Chk1",
name: "Alcohol Treatment",
},{
type: "check_box",
item_id: "Chk2",
name: "Community Confinement",
},
{
type: "check_box",
item_id: "Chk3",
name: "Community Service",
},
{
type: "check_box",
item_id: "Chk4",
name: "Computer Access Denial",
},
{
type: "check_box",
item_id: "Chk5",
name: "Computer Access Monitoring",
},
{
type: "check_box",
item_id: "Chk6",
name: "DNA Collection",
},
{
type: "check_box",
item_id: "Chk7",
name: "Domestic Violence",
},
{
type: "check_box",
item_id: "Chk8",
name: "Drug Treatment or Urinalysis",
},
{
type: "check_box",
item_id: "Chk9",
name: "Financial Disclosure",
},
{
type: "check_box",
item_id: "Chk10",
name: "Gambling Treatment",
},
{
type: "ok_cancel",
ok_name: "Ok",
cancel_name: "Cancel",
},
]
},
]
}
};
// Write Special Conditions
FineRest.aChk1 = false;
FineRest.aChk2 = false;
FineRest.aChk3 = false;
FineRest.aChk4 = false;
FineRest.aChk5 = false;
FineRest.aChk6 = false;
FineRest.aChk7 = false;
FineRest.aChk8 = false;
FineRest.aChk9 = false;
FineRest.aChk10 = false;
if("ok" == FineRest.DoDialog())
{
form1.dbObjects.txtSP1.rawValue=(FineRest.aChk1);
form1.dbObjects.txtSP2.rawValue=(FineRest.aChk2);
form1.dbObjects.txtSP3.rawValue=(FineRest.aChk3);
form1.dbObjects.txtSP4.rawValue=(FineRest.aChk4);
form1.dbObjects.txtSP5.rawValue=(FineRest.aChk5);
form1.dbObjects.txtSP6.rawValue=(FineRest.aChk6);
form1.dbObjects.txtSP7.rawValue=(FineRest.aChk7);
form1.dbObjects.txtSP8.rawValue=(FineRest.aChk8);
form1.dbObjects.txtSP9.rawValue=(FineRest.aChk9);
form1.dbObjects.txtSP10.rawValue=(FineRest.aChk10);
}
Custom dialogs are messy to work with anyway. I use a third party plug-in that has helped me out big time.
StevenD