Answered
Calculate a field based on radio button selection
Hi all,
I have a form field (“RB_Inc_9”) that I want to auto-calculate based on what radio button is selected. Please see the below screenshot for reference:

Here’s what I want to see:
- If the “Salary” radio button is selected, I want the following calculation to run:
- event.value = this.getField("OH").value * this.getField("RB_Inc_1").value + this.getField("OH").value * this.getField("RB_Inc_2").value
- If the “Direct Costs” radio button is selected, I want the following calculation to run:
- event.value = this.getField("OH").value * this.getField("RB_Inc_1").value + this.getField("OH").value * this.getField("RB_Inc_2").value + this.getField("OH").value * this.getField("RB_Inc_3").value + this.getField("OH").value * this.getField("RB_Inc_4").value + this.getField("OH").value * this.getField("RB_Inc_5").value + this.getField("OH").value * this.getField("RB_Inc_6").value + this.getField("OH").value * this.getField("RB_Inc_7").value + this.getField("OH").value * this.getField("RB_Inc_8").value
- If the “Other” radio button is selected, I want no javascript calculation to run
I’ve done some research but still can’t figure out exactly how to run if/then statements in Javascipt.
Thanks!