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

Assigning a value based on a check box

jbbirddog
Registered: Nov 4 2008
Posts: 6
Answered

I am trying to create a script that will populate a value from one text box to another when a check box is checked, and delete the value (or change to 0)when it is unchecked.

Text Box 1 = Text Box 2 when Check Box is checked, else Text Box 2 = 0.

Thanks for any help!

My Product Information:
Acrobat Pro 8.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Well, assuming that the fields are named "TextBox1" and "TextBox2", and you are using an AcroForm, as opposed to a LiveCycle (XFA) form. The code on the check boxes MouseUp event could look something like this:
if(event.target.isBoxChecked(0))this.getField("TextBox1").value =  this.getField("TextBox2").value;elsethis.getField("TextBox1").value =  0;

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

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

jbbirddog
Registered: Nov 4 2008
Posts: 6
Thanks!

This works great!!!