I made a form which I make calculation. If I make this PHP it’s not that hard. But I’m planning to make it Jquery or JavaScript so people whoever puts number into this it can calculate right away they don`t have to click any button. Is there anybody can help me with this ?
Share
OK, I wrote this and you can see it in action here: http://jsfiddle.net/jfriend00/b9dUn/
Here’s what the code looks like. The code could have been a lot more compact, but since you don’t have meaningful field names, I used lots of intermediate local variables to make the code a lot more readable.
The coding would be lot less errorprone if you gave the fields meaningful names like
id="cashDown"instead ofid="textfield9". I obtained the loan payment formula from here. You should verify that it seems correct to you. I made the calculated fields readonly so they cannot be manipulated by typing and I gave them a different color so you can more easily see them after hitting the calculate button.I have not checked this in detail to make sure every part of the calculation is proper and all the input error handling is as desired. You should do that to your satisfaction. This should give you the general idea how to do this.