Click to See Complete Forum and Search --> : Trouble with outputting results into a form


hbradshaw
01-28-2004, 03:06 PM
Hello:

I'm trying to create a form that will calculate APR. The top half of the form is for the user to enter all the necessary data for the calculation to occur. The bottom half of the form shows the results after the user clicks the calculate button.

I wrote the portion of the script that does the calculation. I'm having trouble getting the results to appear in the bottom half of the form.

If you go to this URL, you can try running the script. You can also view the source code. (It's better to do it this way then try to copy and paste bits and pieces of code into this message).



If you click the calculate button, you'll notice that I do not have any results appear. The calculate button is running the
function Execute(oForm). I feel like I need to do something to this function that will allow me to put the results in the proper place.

Unfortunately, I do not know what to do.

Can someone help me?

Thank you.

Pittimann
01-29-2004, 12:11 AM
Hi!

You are just assigning values to variables having the same names like the form fields. Example:

var nPayment = nPrincipal / PresentValue(1, nPercent, iPeriods) ;
nPayment = Round(nPayment + .005, 2) ;

Below that you could have something like:
document.forms[0].nPayment.value=nPayment;

If you do that for all form fields, you should be there...

Cheers - Pit

hbradshaw
01-29-2004, 05:58 AM
Hi Pittimann,

Thanks for your help. My form works perfectly. I can't believe that's all I needed to do.

Thanks again! I appreciate all your help.


:)