Need to exclude a value from a calculation if a checkbox is checked.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robadob1212
    New Member
    • May 2010
    • 1

    Need to exclude a value from a calculation if a checkbox is checked.

    I'm creating a form in Adobe Acrobat 9 Pro.

    The form has 9 text fields. In the first 8 fields, the user manually enters a dollar amount. The ninth field has a calculation that auto-populates the sum of the preceding 8 fields. Beside each of the first 8 fields is a checkbox. If the box is checked then the value in the text field is to be excluded from the calculation in box 9.

    How do I exclude the value in the text box from the total calculation in the 9th text box?

    Example: Each of the first 8 boxes = $0, except for Box 2 and Box 5. Box 2 = $15 and Box 5 = $37. The calculation in Box 9 = $52.

    However, if thec check box next to Box 2 is checked then Box 9 should = $37.

    How should the script be written and where is the script written? In the checkbox, each 8 preceding text boxes or in Box 9?

    I'm new at this and need some help.

    Thank you,

    Rob
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Assuming the JavaScript is the same, check the checked property:
    Code:
    if (!chkbox.checked) {
    // include value in total
    }
    If the syntax isn't the same, you'll need to check the Acrobat JavaScript reference.

    Comment

    Working...