Skip to main content
Participant
June 22, 2016
解決済み

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.
  • 443 ビュー

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?

このトピックへの返信は締め切られました。
解決に役立った回答 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

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?

Forkibbitz作成者
Participant
June 22, 2016

That is exactly correct.

try67
Community Expert
try67Community Expert解決!
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;