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

Using Java script

ejames81
Registered: Sep 30 2009
Posts: 4
Answered

I am trying to use a script calculations in acrobat 8 to perform the following action in a form.
if value in field A equals 5 then put the value of field B into field C. Is this action possible? I have tried a few things but know luck.

Thanks

My Product Information:
Acrobat Pro 8.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Yes. You can use something like this in the custom calculation field:
if (this.getField("A").value==5) {this.getField("C").value = this.getField("B").value;}

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

ejames81
Registered: Sep 30 2009
Posts: 4
In which field should I insert this calculation. A,B,or C. I am not a java user is there anything I need to add to this script or should it work as is?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Doesn't matter where you put it. It should work as is.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

ejames81
Registered: Sep 30 2009
Posts: 4
I created three fields in acrobat 8 and named them A,B,and C. I copied the script and past it into the custom calculation script field in the properties box of field A. The calculation did not work. Any advice?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
The location of the code is important because one wants the code to be triggered whenever the value of "A" or "B" is changed. So if one use the code for the "On Blur" aciton of field "A" it would onlhy trigger when one tabbed through field "A". I was use the 'Custom calculaiton script' of field "C" so the calculation is triggered whenever any field that is used by a calculation is updated.

// custom calculation script for field 'C'if (this.getField("A").value==5) {event.value = this.getField("B").value;} else {event.value = '';}

George Kaiser