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

value of 0 when no radio button is checked (not off)

New Here ,
Jun 29, 2019 Jun 29, 2019

Copy link to clipboard

Copied

I have a field in which I need to sum the numbers in 2 other fields and the results of an optional radio button list. It worked fine when I used Acrobat's built in Value is the option to sum the 3. However, I want the filed to remain blank instead of displaying zero when the form is blank (so Luddites can print it and complete it by hand), so I switched to custom calculation. I got a result of "600off" when no radio button was checked. I tried the below script to substitute zero for "off" when no radio button is checked, but am getting a syntax error at the zero. I tried putting the zero in quotes to no avail. This form is my first foray into javascript and I clearly only know enough to be dangerous. Thanks in advance for any input.

event.value = this.getField("Total Fees").value + this.getField("Other Amnt").value + if(this.getField("Donation").value = ”off” {

0;

} else {

this.getField("Donation").value;

}

if (event.value == 0) {event.value = "";}

TOPICS
Acrobat SDK and JavaScript , Windows

Views

151

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
no replies

Have something to add?

Join the conversation