Copy link to clipboard
Copied
Hello,
I'm pretty new to form creation and would like to use radio buttons to calculate a value based on two criteria: resident/non-resident, and early/standard registration period.
The group for the Radio Buttons is "Entry Fee", and the options are 1) "Resident Early Bird", 2) "Non-Resident Early Bird", 3) "Resident Standard", and 4) "Non-Resident Standard". They should output the value that they're associated with in the "Entry Fee Calculation" box. I discovered the custom calculation script feature but can't find the right code to make it work.
Thanks for the help!
Copy link to clipboard
Copied
You don't need script for this, instead of text give it price value, for example change "Resident Early Bird" to 15...etc for all other buttons, then go to text field properties select 'Calculate' tab and 'Value is the' and pick "Entry Fee".
EDIT:
If you still decide for a script, use this as custom calculation script of text field:
var rb = this.getField("Entry Fee").valueAsString;
var fees = {
"Resident Early Bird": 15,
"Non-Resident Early Bird": 18,
"Resident Standard": 25,
"Non-Resident Standard": 30};
var total = fees[rb] || 0;
event.value = total;
Copy link to clipboard
Copied
You don't need script for this, instead of text give it price value, for example change "Resident Early Bird" to 15...etc for all other buttons, then go to text field properties select 'Calculate' tab and 'Value is the' and pick "Entry Fee".
EDIT:
If you still decide for a script, use this as custom calculation script of text field:
var rb = this.getField("Entry Fee").valueAsString;
var fees = {
"Resident Early Bird": 15,
"Non-Resident Early Bird": 18,
"Resident Standard": 25,
"Non-Resident Standard": 30};
var total = fees[rb] || 0;
event.value = total;
Copy link to clipboard
Copied
Thank you! Changing the names to their price value worked perfectly, but thank you for the script form as well!