PDA

View Full Version : Cannot get the Sum of 2 Form Boxes to add


elksfc
01-30-2007, 03:18 AM
Hope I have this in the right section first off...I really need someone's help on a very simple issue. I've been close to getting this to work but I'm wasting way to much time on what seems like a simple java issue!
o.k so the issue is, I cannot get a "sum" function to work on a form page on a site I designed. Until I get this working I cannot go forward with more sites for him so I really need this help.....

The page with the form is ---> http://www.savinghomesacrossamerica.com/Application.html

I need the bottom three boxes to do an auto sum function...

Monthly Expenses: <---- This box when a number is entered +
Total Income: <---- This box when a number is entered =
Net Income: <---- And the total of those two would automatically be displayed here!

I have made this work in the ".PDF" format --> http://www.savinghomesacrossamerica.com/form/form_saving.pdf
but for the life of my I cannot get the java "sum" function to work on this embed form... any help would be a life and time saver! Thank you in advance:thumbsup:

Mr J
01-30-2007, 02:15 PM
This may do it

<script type="text/javascript">

function addMe(){
v1=document.getElementById("field-2f60379b2872de6").value
v2=document.getElementById("field-a1d9a4eafec5086").value

v3=Number(v1)+Number(v2)

document.getElementById("field-892ca1ebfe4f3f3").value=v3

}

</script>

and add onkeyup="addMe()" to the Monthly Expenses and Total Income input tags

elksfc
02-01-2007, 04:58 PM
:thumbsup: Thank you J!!!! Your a life saver my friend, works perfectly!