Copy link to clipboard
Copied
I have a transcript request form that I need to calculate a total dollar amount in a field at the bottom based on which options are selected. The form is set up like this:
Checkbox 1: $5 mail unofficial transcript
Checkbox 2: $5 mail official transcript
Checkbox 3: $5 email transcript
Radio 1: BSB transcript
Radio 2: degree transcript
Radio 3: both BSB and degree transcript ($5 each)
Text field total: This amount should be the sum of the checkboxes (one or more can be selected, each valued at $5) and IF Radio 3 is selected, should be multiplied by 2 (so, if I want a transcript by mail and by email, for both BSB and degree, then my total would be $20; 5+5x2).
Is this possible?
Yes, it's possible. However, the radio-buttons should have the same name but unique "radio button choice" values, not unique names for each one (because that would mean that you could select multiple ones). Let's say they are all called "Radio" and their values are 1, 2 and 3. You can then use this code as the custom calculation script of your total field:
var total = 0;
if ((this.getField("Checkbox 1").valueAsString)!="Off") total+=5;
if ((this.getField("Checkbox 2").valueAsString)!="Off")
...
Copy link to clipboard
Copied
Yes, it's possible. However, the radio-buttons should have the same name but unique "radio button choice" values, not unique names for each one (because that would mean that you could select multiple ones). Let's say they are all called "Radio" and their values are 1, 2 and 3. You can then use this code as the custom calculation script of your total field:
var total = 0;
if ((this.getField("Checkbox 1").valueAsString)!="Off") total+=5;
if ((this.getField("Checkbox 2").valueAsString)!="Off") total+=5;
if ((this.getField("Checkbox 3").valueAsString)!="Off") total+=5;
if ((this.getField("Radio").valueAsString)=="3") total*=2;
event.value = total;
Copy link to clipboard
Copied
I'm trying it, but it says there is a "syntax error 2: at line 3."
Copy link to clipboard
Copied
Sorry, fixed it now.
Copy link to clipboard
Copied
It works, thank you so much!