Skip to main content
Inspiring
June 23, 2022
Question

Acrobat forms if radio buttons and checkboxes checked

  • June 23, 2022
  • 1 reply
  • 6304 views

Hi everybody,

I'm trying to create an acrobat form for the first time with some JS code. I'm trying since two days now, but somehow cannot figure out how to check if radio buttons and checkboxes are checked and then do a specific calculation.

The form looks like this. In the last field should come a calculation with the values of the fields above. So for example if radio option 2 and first checkbox are check the total value is 60, so in the bottom field has to be "9" (15% of 60).

 

Hope somebody here can help me out with this.

 

Appreciate any help or advice you could give.

 

Thanks a lot in advance!

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 23, 2022

You actually don't need a script. If you've applied those values as the export values of the fields then you can use this formula under the Simplified Field Notation option of the last field (you didn't specify the field names, so let's say they are Radio1, CheckBox1 and CheckBox2:

 

(Radio1 + CheckBox1 + CheckBox2) * 0.15

Rostam777Author
Inspiring
June 23, 2022

Thanks a lot for your quick reply! Sounds really interesting, but where can I set the export value?

Bernd Alheit
Community Expert
Community Expert
June 24, 2022

Did that and works, thanks!

 

Now it seems I have a bug in the add-calculation on the second page.

 

I inserted the blue text-field for testing only, that's why it is on the side. Looks like this now:

the code of the blue field is this:

event.value =
(this.getField("Radio_option_price").value) +

(this.getField("CheckBox1_option_price").value) +

(this.getField("CheckBox2_option_price").value) +

(this.getField("ChcekBox3_option_price").value) +

(this.getField("RadioExpress_option_price").value)

 

In this example there are only values for "Radio_option_price" and "CheckBox3_option_price". All fields are formated as numbers, currency CHF.


It concatenes the text strings. Use the number values.