This is my first attempt at writting a doc level script that includes variables and arrays. I obviously did something wrong since it doesnt work; but I got no syntax errors when I added it to my doc.
(Assumption made: I can use arbitrary names for the variables; hoping they do not conflict with any hard coded ones.) Is there a source where I can look for the hard coded (allowed) variables?
Would someone please assist me to get it to work.
Goal of the script: When a specific checkbox is selected, check for the value of a specific radio/checkbox, each with respective widgets (#1 vs. #1, #2 vs. #2, etc). If criteria of argument is met, run app.alert.
function test() { // List all radio style checkboxes. var regtype = new Array(10); regtype[0] = this.getField("Reg.Type.1"); regtype[1] = this.getField("Reg.Type.2"); regtype[2] = this.getField("Reg.Type.3"); regtype[3] = this.getField("Reg.Type.4"); regtype[4] = this.getField("Reg.Type.5"); regtype[5] = this.getField("Reg.Type.6"); regtype[6] = this.getField("Reg.Type.7"); regtype[7] = this.getField("Reg.Type.8"); regtype[8] = this.getField("Reg.Type.9"); regtype[9] = this.getField("Reg.Type.10"); // List all checkboxes which will call this script if and when checked. var chkbx = new Array(10); chkbx[0] = this.getField("Reg.Event.Workshop.1"); chkbx[1] = this.getField("Reg.Event.Workshop.2"); chkbx[2] = this.getField("Reg.Event.Workshop.3"); chkbx[3] = this.getField("Reg.Event.Workshop.4"); chkbx[4] = this.getField("Reg.Event.Workshop.5"); chkbx[5] = this.getField("Reg.Event.Workshop.6"); chkbx[6] = this.getField("Reg.Event.Workshop.7"); chkbx[7] = this.getField("Reg.Event.Workshop.8"); chkbx[8] = this.getField("Reg.Event.Workshop.9"); chkbx[9] = this.getField("Reg.Event.Workshop.10"); // Respective fields used in 'if' argument (examples). // Reg.Event.Workshop.1 verses Reg.Type.1.; Reg.Event.Workshop.2 verses Reg.Type.2; etc. var eventTarget = this.getField(chkbx[i]); var oCk = {bAfterValue:false}; fld = this.getField(regtype[i]); if ((eventTarget.isBoxChecked) && (eventTarget.value == "yes") && (fld.value == "member") && !this.hideWarning1) { app.alert ({cMsg: "[i]my message[/i]", nIcon:3, cTitle:"REGISTRATION ALERT", oCheckbox:oCk}); hideWarning1 = oCk.bAfterValue; } }
I know the app.alert works. The problem is with all of the code above the app.alert.
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com