Skip to main content
Participant
April 4, 2024
Answered

Having 2 different total depending on checkbox checked

  • April 4, 2024
  • 1 reply
  • 519 views

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

 

This topic has been closed for replies.
Correct answer Thom Parker

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;

 

 

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
April 4, 2024

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 PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
April 4, 2024

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