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

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?

Community Beginner ,
Jun 22, 2016 Jun 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?

TOPICS
Acrobat SDK and JavaScript
370
Translate
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

correct answers 1 Correct answer

Community Expert , Jun 22, 2016 Jun 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;

Translate
Community Expert ,
Jun 22, 2016 Jun 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?

Translate
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 Beginner ,
Jun 22, 2016 Jun 22, 2016

That is exactly correct.

Translate
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 ,
Jun 22, 2016 Jun 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;

Translate
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 Beginner ,
Jun 22, 2016 Jun 22, 2016

Where do I find the "Export Value Field".... I don't see it under properties?

Translate
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 ,
Jun 22, 2016 Jun 22, 2016

Sorry, it got renamed to "Radio Button Choice". It's under Properties - Options.

Translate
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 Beginner ,
Jun 22, 2016 Jun 22, 2016
LATEST

Thank you SO MUCH...That worked perfect!

Translate
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