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

Calculations based on radio button values

Explorer ,
Nov 30, 2022 Nov 30, 2022

Two quick questions if I may... please see a screenshot below of my Acrobat form...

Question 1

I have created a basic Java Script calculation to sum the value of the quantities under the "food section" (i.e. (Refreshments*2)+(Food_1*6.5)+(Food_2*10)+(Food_3*3)).

But would like to add £30 to the total field ("TOTAL") if the half day radio button ("Half_Day") is selected, or £50 of the full day button is selected (Full_Day")

Question 2

Presumably the 25% deposit field would be calculated by stating that it equals TOTAL*0.25?

Thanks in advance

 

Simon

 

Screenshot 2022-11-30 at 11.52.38.pngexpand image

TOPICS
PDF forms
1.2K
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 ,
Nov 30, 2022 Nov 30, 2022

1. You would need to use custom calculation script, also is quantity supposed to be calculated only if corresponding radio button is checked? Are those radio buttons belong to same group?

2.Yes.

Can you share your file?

 

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 ,
Nov 30, 2022 Nov 30, 2022
LATEST

You'll find the articles here very useful.  Be sure to read the "Entering Calculation" Scripts article, especially the part on calculation order.  

https://www.pdfscripting.com/public/Calculating-field-values-and-more.cfm

 

An "if" statement will be needed in the custom calculation to provided the requested fuctionality.  To help you with this we'll need to know the name of the radio button field and it's export values.  You can read about the basics of scripting radio buttons here:

https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm

 

 

 

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