Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using Drop-Down fields for addition and subtraction

New Here ,
Apr 08, 2025 Apr 08, 2025

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?

 

TOPICS
How to , JavaScript
118
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Apr 08, 2025 Apr 08, 2025

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2025 Apr 08, 2025

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2025 Apr 08, 2025

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 08, 2025 Apr 08, 2025
LATEST

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines