Skip to main content
Participant
June 22, 2016
Answered

I have 3 radio button options to chose from, but I only want one certain one to calculate a sales tax. How can I assign a calculation to one radio button?

  • June 22, 2016
  • 1 reply
  • 442 views

I have 3 radio button options to chose from, but I only want one certain one to calculate a sales tax. How can I assign a calculation to one radio button?

This topic has been closed for replies.
Correct answer try67

OK. Let's say the name of the radio-button group is "Radio1", the export value of that field is "3", the name of the sub-total is "SubTotal" and the tax rate is 16%. You can use this code as the custom calculation script of the Tax field:

event.value = (this.getField("Radio1").valueAsString=="3") ? Number(this.getField("SubTotal").valueAsString) * 0.16 : 0;

1 reply

try67
Community Expert
Community Expert
June 22, 2016

Can you describe the full situation, please? Do you mean that you have something like a sub-total and a tax field, and the tax field should only be populated if that specific button is selected? Should it be zero otherwise?

Participant
June 22, 2016

That is exactly correct.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
June 22, 2016

OK. Let's say the name of the radio-button group is "Radio1", the export value of that field is "3", the name of the sub-total is "SubTotal" and the tax rate is 16%. You can use this code as the custom calculation script of the Tax field:

event.value = (this.getField("Radio1").valueAsString=="3") ? Number(this.getField("SubTotal").valueAsString) * 0.16 : 0;