These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Please HELP!

BeanieRaven
Registered: May 20 2008
Posts: 3
Answered

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);
}

StevenD
Registered: Oct 6 2006
Posts: 368
It looks like you are trying to do a custom dialog in a LiveCycle Desiger form. I thought that was only possible in Acrobat. Could someone else jump in here and clarify this?

Custom dialogs are messy to work with anyway. I use a third party plug-in that has helped me out big time.

StevenD

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes you can use a custom dialog in an LC form. You have to be a bit carful about how it's handled since the document object is different, but overall there isn't an issue.

The problem with the 10th check box, but otherwise your code looks good. The problem is with the "item_id". An element "id" cannot be longer than 4 characters. You'll have to give it a different name.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

StevenD
Registered: Oct 6 2006
Posts: 368
I didn't realize you could use dialogs in LCD. Is there any thing written out there explains what to watch out for and how to implement something like this?

StevenD

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Well, as far as custom dialogs go there isn't a whole lot of documentation period:( But I do have an example in the AcroDialogs Help doc of using a dialog in an LC form.

What you have to watch out for is operations involving the document object. But this is a minor concern.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

StevenD
Registered: Oct 6 2006
Posts: 368
Thanks for the leads Thom.

StevenD

BeanieRaven
Registered: May 20 2008
Posts: 3
thomp wrote:
Yes you can use a custom dialog in an LC form. You have to be a bit carful about how it's handled since the document object is different, but overall there isn't an issue.The problem with the 10th check box, but otherwise your code looks good. The problem is with the "item_id". An element "id" cannot be longer than 4 characters. You'll have to give it a different name.
Thank you Thom. I was out this week but will rename the item_id and run it when I return to work on Monday. Can't thank you enough Thom. This problem has been driving me crazy :-)