Skip to main content
Participant
Apr 8, 2025 6:20 PM UTC
Answered

Using Drop-Down fields for addition and subtraction

Good afternoon! I am making a self-assessment in adobe pro.  I have 64 drop-down menus, named Dropdown1, Dropdown2, and so on.  Each drop-down menu has a value of 0-10.  I am trying to create several calculated text field boxes using the values chosen on the drop-down menus.  So, for instance, we add up four drop-down values, add 40, and subtract four drop-down values for a total.

So far I have tried:

Dropdown1 + Dropdown2 + ... + 40 - Dropdown20 - Dropdown25 in the Simplied field notation box.

That just kicked me back to the "Value is Not Calculated" when I click "OK".

 

I tried the same formula in the Simplified field notation box but took out the spaces in between the names.  Same result.

Next, I tried the Javascript function.  event.value = getField("Dropdown1").value;+getField("Dropdown2").value; ... +40-getField("Dropdown5").value;getField("Dropdown6").value;

After clicking OK, this also just kicked me back out to the text field properties.

I am obviously doing something wrong, or what I am trying to do is not possible.  Any ideas?

 

Thom Parker
Thom ParkerCorrect answer
Community Expert
Apr 8, 2025 7:27 PM UTC

Acrobat sometimes deletes calculations. This has been a problem for a long time. And there is no resolution, or explanation as to why it happens. 

Can you post the form?  i can give it a try and see if it happens on my machine. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often

3 replies

Participant
Apr 8, 2025 7:29 PM UTC

SOLVED!
Hey all, I managed to fix it.  I'm not sure what I did differently. I think Thom is on to something about the calculations randomly deleting.  The simplified field notation worked.

Translate
Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
Apr 8, 2025 7:27 PM UTC

Acrobat sometimes deletes calculations. This has been a problem for a long time. And there is no resolution, or explanation as to why it happens. 

Can you post the form?  i can give it a try and see if it happens on my machine. 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
Community Expert
Apr 8, 2025 7:19 PM UTC

Change the code to something like this (replace the ellipsis with the other field names, in the same format):

 

event.value = Number(this.getField("Dropdown1").value) + Number(this.getField("Dropdown2").value) + ...  + Number(this.getField("Dropdown6").value);

 

If it's still not working share the file for further help.

Translate