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

Drop down menu percentage calculation

New Here ,
Dec 31, 2024 Dec 31, 2024

Copy link to clipboard

Copied

I tried looking at previous examples of this but my javascript is pretty limited so I'm still a little confused. I want to calculate specific fields for a cumulative value of 100%. For example 6 fields at roughly 16.6%. I want to execute this via a drop down menu and have it populated cumulatively as each of the 6 fields is selected...so if only one field is selected, the cumulative value would be only 16.6%, if two fields, then it would be 2x16.6% etc. I attached an image of how each of the six fields would be setup.

Dropdown Properties.png

TOPICS
JavaScript , Modern Acrobat , PDF , PDF forms

Views

179

Translate

Translate

Report

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 ,
Dec 31, 2024 Dec 31, 2024

Copy link to clipboard

Copied

Don't use JavaScript. Do this instead:

1) Include export values for each of the dropdown entries.

     a) 0 for "incomplete"

     b) 16.6 for "complete". 

     c) Don't use "Select", delete it, and make "incomplete" the default. 

2) for the result field, use the built-in Sum calculation. 

 

 

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

Votes

Translate

Translate

Report

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 ,
Dec 31, 2024 Dec 31, 2024

Copy link to clipboard

Copied

Thanks Thom for the quick response; I will give this a try!

Votes

Translate

Translate

Report

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 ,
Dec 31, 2024 Dec 31, 2024

Copy link to clipboard

Copied

It worked! I just need to figure out how to make it capture 16.6% and not 1660.0% in the result field but I'll play with the format to straighten it out, Thanks again!

Votes

Translate

Translate

Report

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 ,
Dec 31, 2024 Dec 31, 2024

Copy link to clipboard

Copied

Change the export value to 0.166

Votes

Translate

Translate

Report

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 ,
Jan 01, 2025 Jan 01, 2025

Copy link to clipboard

Copied

LATEST

Awesome! Happy New Year!

Votes

Translate

Translate

Report

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 ,
Dec 31, 2024 Dec 31, 2024

Copy link to clipboard

Copied

Your question is very confusing.  Where does the result go?  In a text field?  Is it 6 separate dropdowns like the one pictured that feeds the result?

Votes

Translate

Translate

Report

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 ,
Dec 31, 2024 Dec 31, 2024

Copy link to clipboard

Copied

Thanks for quick response; so yes, it is 6 seperate dropdowns that feed the result. And the result is a seperate text field under the category "% complete". I want the result text field to accumulatively calculate each one of the dropdowns as they are completed. 

Votes

Translate

Translate

Report

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 ,
Dec 31, 2024 Dec 31, 2024

Copy link to clipboard

Copied

Use @Thom Parker 's solution.  You can leave "Select" if you want but make that 0 export value as well.  Also, check "Commit selected value immediately" in the options tab of the dropdowns so the results will appear as soon as a selection is made instead of on a blur event (leaving the field).

Votes

Translate

Translate

Report

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