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

Check All Button

kcdoell
Registered: Jan 30 2008
Posts: 14

Hello:

I have a form that has a section where a user can select the states that are applicable for processing. For example, a user may check off only 5 of the 50 states that are listed on the form. The business owner wants to maintain the current tabular format of these select state options which is currently in Word format.

There are cases were all 50 states apply for processing. In that case, I want to mimic a functionality that exists in the Word form doc, a “select all” check box. If this checkbox was selected then all of the states that are displayed on the form would self populate with a check mark. This functionality works in Word using some VBA coding. Can this be done somehow in the PDF form? I can't seem to find any info on how this can me done on the Adobe help menu.

Any assistance would be greatly appreciated.

Thanks,

Keith.

Proud to be an American!

My Product Information:
Acrobat Pro 8.1.1, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, you can do this. However, it will require some JavaScript, and proper naming of your check boxes.

The fucntion for setting check box value is "field.checkThisBox()". Look it up in the Acrobat JavaScript Reference.

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

kcdoell
Registered: Jan 30 2008
Posts: 14
Thanks for getting back to me!

How do I access the JavaScrip Reference. Is that in the help menu? I tried to input the "field.checkThisBox()" in the search parameter of the Adobe help menu and it could not find any topics. Also, do you have an example that I could expand off of since I do not know that much about Java Coding?

Thanks,

Keith.

Proud to be an American!

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You can get the material form either of the following 2 sites:

Adobe SDK doumentation: http://www.adobe.com/devnet/acrobat/
Acrobat JavaSdript documentation: http://www.adobe.com/devnet/acrobat/javascript.php

George Kaiser

kcdoell
Registered: Jan 30 2008
Posts: 14
Before I sent the troops out for help, I saw the post that referenced those two links. I downloaded two files from the one weblink (Acrobat JavaSdript documentation: http://www.adobe.com/devnet/acrobat/javascript.php) but could not find the topic for "field.checkThisBox". I just downloaded the other with still no luck. Which document specifically talks to the "field.checkThisBox()" coding?

Thanks,

Keith.

Proud to be an American!

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
For Acrobat JavaScript the method should be "isBoxChecked(nWidget)" which can be used to check the value of a check box.

Depending on how you have named your check boxes and the export value of each box, one could write a function or script to loop through the state field check boxes and set them to the export value.

George Kaiser

kcdoell
Registered: Jan 30 2008
Posts: 14
Hello:

I am still trying to solve this problem. Since we last spoke I figured out what I think is bringing me closer to the solution but it still does not work. So far I have my Checkboxes named the following:

SS.1
SS.2
SS.3
SS.4
SS.5
Ect. up to SS.50

Then I tried to create a loop and attach it to a button object (my select all button) in the mouseup event of the javascript:

var s="";
for(var i=1;i<51;i++){
s="SS."+i;
getField(s).value="Yes"
}

It did not work. Does anybody have any ideas on what I am mission in the code or execution?

Thanks,

Keith.

Proud to be an American!

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Exactly what is happening?

Is just the first or last check box not checked? Then there is an issue with the counter start or end value.

Is there a series of check boxes not checked? Then you have a calculation script(s) that are useing "i" as a counter within a script. After each individual box is checked the entire form is reclculated. You will either need to use a different counter variable or turn off the auto calculation property, update the buttons and trun on the auto calculation property.

app.calculate = false;
for(var i = 1; i < 51; i++){
this.getField("SS." + i).value="Yes"
}
app.calculate = true;

George Kaiser

kcdoell
Registered: Jan 30 2008
Posts: 14
Thanks for getting back to me....

When I load the post script that I created and place it in the Mouseup event, I then go into pdf viewing mode where I find that the button does not do anything. It clicks but that is about it. The individual check boxes work...

I will try your suggestion and let you know how it goes.

Thanks,

Keith.

Proud to be an American!

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
The code is for Acrobat Forms not LIveCycle Designer JavaScript.

Are you getting any messages on the JavaScript Debugging console?

George Kaiser

kcdoell
Registered: Jan 30 2008
Posts: 14
No and that is what is throwing me off.

Proud to be an American!

LisaS
Registered: Feb 25 2006
Posts: 2
Hello, I have the same situation on a form I am creating and would like to have a select all button that when checked populates all the other check boxes. Is there a way to do this in Adobe Professional 7? Thank you for your advice. I am not able to find any javascript examples for this situation.
kcdoell
Registered: Jan 30 2008
Posts: 14
Checkboxes called:

6.1.2000
6.1.2001
6.1.2002
6.1.2003
Etc.

JavaScript code for "Select All" Button

var s="";
for(var i=2000;i<2008;i++){
s="6.1."+i;
getField(s).value="Yes"
}
___________________________

Proud to be an American!

LisaS
Registered: Feb 25 2006
Posts: 2
Thank you so much for your reply. I altered the field names per my form, and it worked great. I really appreciate your advice and quick reply. Thanks again.