Copy link to clipboard
Copied
I have a document with 2 different options to choose from. Upfront payment, or monthly repayment.
I need to know what Javascript to write: If option 1 is selected, then value is "Total Cost", but if Option 2 is selected, then value is "Total Cost / 36"
Thanks
1 Correct answer
Make sure the choice values of the radio buttons are set to Choice1 and Choice2. You'll find the Radio button Choice value on the Options tab of the radio button properties dialog, the
Add this code to the Calculation script for the field that will display the value.
event.value = this.getField("Total Cost").value;
if(this.getField("RadioButton").value == "Choice2")
event.value = event.value/36;
Copy link to clipboard
Copied
Make sure the choice values of the radio buttons are set to Choice1 and Choice2. You'll find the Radio button Choice value on the Options tab of the radio button properties dialog, the
Add this code to the Calculation script for the field that will display the value.
event.value = this.getField("Total Cost").value;
if(this.getField("RadioButton").value == "Choice2")
event.value = event.value/36;
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Thank you!
Copy link to clipboard
Copied
There is no tab for calculation in your example. How do I get to the calculation field to put in the script?

