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

Having 2 different total depending on checkbox checked

New Here ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Hi, i have very limited knowledge of calculaton in adobe acrobat

 

i am trying to get a total in the total payment colomn.

Entry Level check box = 21.41

Level 1 check box = 26.60

 

the client input the monthly total hours.

i need that if they check first check box it will calclate the value of that checkbox times the number of hours and if they check box 2 it will calculate the check box value times the number hours. they can of  only choose 1 checkbox

Bernard27507687a3lt_0-1712255784442.png

 

TOPICS
How to , JavaScript , PDF

Views

258

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
1 ACCEPTED SOLUTION
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

If they can only choose one, then you need to give them the same name. 

 

Then the calculation script would look like this:

 

var chkVal = this.getField("LevelCheck").value;

if((chkVal != "Off")  && !isNaN(chkVal))

   event.value = this.getField("NumHours").value * Number(chkVal);

else

   event.value = 0;

 

 

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

View solution in original post

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 ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

If they can only choose one, then you need to give them the same name. 

 

Then the calculation script would look like this:

 

var chkVal = this.getField("LevelCheck").value;

if((chkVal != "Off")  && !isNaN(chkVal))

   event.value = this.getField("NumHours").value * Number(chkVal);

else

   event.value = 0;

 

 

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 ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

LATEST

Thank you so much, this worked perfectly. Really appreciate the help!

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