Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Script for Calculation of Check Boxes

Avatar

Level 2

I have four checkboxes, each one with a different dollar amount. I want to have a total, calculated and shown, in a numerical field based on whichever checkboxes are checked. Please help.

Checkbox #1 (if checked =$125, not checked =$0)

Checkbox #2 (if checked =$ 90, not checked =$0)

Checkbox #3 (if checked =$ 10, not checked =$0)

Checkbox #4 (if checked =$ 35, not checked =$0)

Total = $260 (if all four checked)

Total = $125 (if 2 and 4 are checked)

1 Reply

Avatar

Level 6

You can add the value to your check box in the "on" position. 

Click on checkbox 1 and use the "Binding" tab of the Object pallette.  In the ON value box, type 125. 

Repeat for checkboxes 2-4 designating the correct value.

To your numeric field, first set the data pattern to $Z,ZZ9.99. 

Then add the formCalc script:  Sum(CheckBox1, CheckBox2, CheckBox3, CheckBox4)

Let us know if you need more help