Assistance with PDF Calculation: Want active Checkboxes to Subtract Value from Specified Text Field
Hey there everyone! I'm just stretching my coder wings in regards to javascript.
I've been diving deep into custom PDFs and Calculations. What I'm trying to accomplish seems simple; but I can't find the resources anywhere to help me resolve the problem. Most likely it's because I don't get know how to ask the right question.
What I'm trying to accomplish is to set up a Calculation where if a checkbox is activated (checked) then it Subtracts 1 from a specified Text (number) field elsewhere on the page. If I can get one checkbox working then I can implement the technique elsewhere and on future projects.
The project I'm working on may seem frivolous, but it's a very valuable and practical learning activity for me. I'm currently making a custom Character Sheet for a Tabletop RPG. I have all the other fields functioning precisely as desired; but they're all simple addition or cloning of values from other text fields.
So here's the situation:
I have 12 check boxes; they represent damage penalties accrued by the player. Ideally each of these checkboxes would subtract one (-1) from the "Toughness" text field's current value when they are selected.
They are all uniquely identified: "injury1" "injury2" etc through "injury12"
The text field is "defense_toughness_total" if I can figure out how to get "injury1" to subtract one (-1) from "defense_toughness_total" when it's selected (checked, active) I should be golden from there.
It seems like
if (this.getField("injury1").checked = checked) {
this.getField("defense_toughness_total").value -= 1}just isn't the way to go about this.
Any help, or guidance would be greating appreciated.
For additional reference:


The part of the code I'm using that works is:
//Toughness - Base
this.getField("defense_toughness_base").value =
this.getField("sta_total").value
//Toughness - Total
this.getField("defense_toughness_total").value = 1 *
(this.getField("defense_toughness_base").value
+ this.getField("defense_toughness_rank").value)And I'm just at a total loss as to how to incorporate the checkbox into the mix.
