Skip to main content
Participant
August 19, 2021
Question

I would love some help to total some pull down selection boxes in another section of my PDF document

  • August 19, 2021
  • 2 replies
  • 449 views

I am editing a PDF that has 51 dropdown lists. They are titled "Code1" "Code2" all the way down to  "Code51"

 

Each dropdown list is the same and has the same following selections:

A"blank" selection that is a single space bar so the field looks blank.

N

NAM

R

RAM

RDM

R/I

NDM

N*

NAM*

NDM*

L-35

L-36

L-51

L-65

CARDG

CARDP

 

On another part of the form, I have the same items listed with a text field beside it in a recap section at the end of the form. example:

N ______        NAM ________

 

My goal is that each time a selection for the total number of times a selection is made from a dropdown list to be displayed in the recap section

example:

 

If I have chosen "N" a total of 19 different times in 19 of the 51 dropdown lists, it will read "N      19   " in the recap section.

 

I'm assuming this will take some sort of script.... I am extremely new to this so please spell it out for me and if you don't mind doing it so that I can copy and past the script, that would be AWESOME!

This topic has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
August 19, 2021

 

here is the code to count the number of times "N" is selected

 

var nSum = 0;
for(var i=1;i<=51 ; i++)
{
    if(this.getField("Code" + i).value == "N")
        nSum++;
}
event.value = nSum;

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Amal.
Legend
August 19, 2021

Hi JDSAINTS

 

Hope you are doing well and sorry for the trouble. As described, you want to total some pull down selection boxes in another section of my PDF document

 

The workflow that you are trying to achieve is possible using the JavaScript. For more information about using Javascript please check the help page https://acrobatusers.com/tutorials/javascript_console/

 

Regards

Amal