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

Checkbox in Acrobat

center
Registered: May 24 2008
Posts: 2

I am using Acrobat 5. I should make a form where is text fields which has some default value. Every field has a checkbox and if it is not checked value will be 0.
Can someone help me how to do this?

My Product Information:
Acrobat Standard 5.x or older, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You want to use a check box to clear a field? This is a very straight forward operation. Place code similar to this in the mouse up event of the check box.

if(!event.target.isBoxChecked(0))
{
this.getfield("MyText1").value = 0;
this.getfield("MyText1").readonly = true;
}
else
{
this.getfield("MyText1").readonly = false;
}

If you want the text field to remain zeroed, you should also set the field to readOnly.

You might also consider greying out the zeroed field. Take a look at this article:

http://www.acrobatusers.com/tutorials/2007/js_disabling_fields/

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

rmahrling
Registered: Jun 2 2008
Posts: 2
Ok - I am so new to Javascripting that I may have to ask something that is completely silly here.

I have a checkbox (let's call it TestCheck) and I want another field to calculate a value based on whether or not TestCheck is checked (text field is called TestText)

Now TestText already has some other calculations in it that are working just fine, but, I wanted to know do I need to edit TestCheck to return a value (5) when checked/0 when empty) or do I just add that into TestText calculations?

And then how (code) do i check to see if TestCheck is checked?

I apologize in advance for my learning curve, but this is one of the more recent post for something similar to what i am trying to do.

Thx,
Roger
jbfreels
Registered: Feb 19 2008
Posts: 63
test...

this.getField("TestCheck").value
rmahrling
Registered: Jun 2 2008
Posts: 2
Thx, that worked just fine :)