• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
15

Using Radio Buttons to calculate a dollar amount

New Here ,
Feb 02, 2024 Feb 02, 2024

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.

 

Andrew35207481jr3n_0-1706888619543.png

 

Thanks for the help!

TOPICS
How to , PDF , PDF forms

Views

359

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Feb 02, 2024 Feb 02, 2024

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;

View solution in original post

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 02, 2024 Feb 02, 2024

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 02, 2024 Feb 02, 2024

Copy link to clipboard

Copied

LATEST

Thank you! Changing the names to their price value worked perfectly, but thank you for the script form as well!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines