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

Calculated field but if over an amount equals zero

New Here ,
Jul 13, 2017 Jul 13, 2017

I am trying to make a form that uses an input field (Estimated Sales Price of Current Residence) to calculate the Guaranteed Homesale Program value, which is Estimated sales price of current residence x  .15. But if the Estimated sales price of Current Residence is more than $750,000, then I want Guaranteed Homesale Program field to equal 0. I tried the following but an getting errors.

var n = this.getField("Estimated Sales Price of Current Residence").value;

if (n < 750000) {event.value = ("Estimated Sales Price of Current Residence * .15");}

else if (n > 750000) {event.value = "0";}

TOPICS
Acrobat SDK and JavaScript , Windows
604
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 , Jul 13, 2017 Jul 13, 2017

Use this:

if (n < 750000) {event.value = n * 0.15;}

else if (n > 750000) {event.value = 0;}

Translate
Community Expert ,
Jul 13, 2017 Jul 13, 2017

Use this:

if (n < 750000) {event.value = n * 0.15;}

else if (n > 750000) {event.value = 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
New Here ,
Jul 13, 2017 Jul 13, 2017

Thank you!!! If I want to limit the return value to $10,000 how would I also include that?

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 ,
Jul 13, 2017 Jul 13, 2017
LATEST

if (n <= 750000) {

  n = n * 0.15;

  if (n > 10000) n = 10000;

  event.value = n;

}

else event.value = 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