Skip to main content
rajs91353029
Known Participant
August 11, 2018
Answered

PV (present value) value for Rate, Nper & PMT

  • August 11, 2018
  • 1 reply
  • 4428 views

I am new to Javascript and trying to create PDF form which will calculate PV (present value) value for based on fields like Rate, Nper & PMT. Please help me regarding this. I think people with good experience about Javascript can solve this.

This topic has been closed for replies.
Correct answer try67

The code is working but thing is that until I enter the value in the form , it keeps on showing me alert messages which says "the value entered doesnt match the format of the field. How to remove this alert message?


That's happening because you're trying to divide by zero.

Use this instead:

var R = Number(this.getField("Rate").valueAsString);

var N = Number(this.getField("NPER").valueAsString);

var P = Number(this.getField("PMT").valueAsString);

if (R!=0) {

    event.value =P*(1-(Math.pow((1+(R/100)),-N)))/(R/100);

} else event.value = "";

1 reply

Inspiring
August 11, 2018

This has been asked before. Have you used the search feature?

Do we need to supply the formula and code?

rajs91353029
Known Participant
August 11, 2018

Hi, I used search but I could not find PV formula which I can use to get the result. Please supply the formula and code and kindly also help me how to put and where to put the code so it executes. I really don't have Javascript knowledge. Thank you