Ok, I got my two fields to add up and display in another field with this:

onchange="window.document.ExpenseForm.TotalAmount#Line#.value=parseFloat(window.document.ExpenseForm.Mileage#Line#.value)+parseFloat(window.document.ExpenseForm.CostOfMeals#Line#.value);addTotals();"

Now I'm trying to add up all the TotalAmounts and put it at the bottom of 
the form.  I need to loop through the entire list from 1 to #list# on each 
onChange and update the GrandTotal.  I can't figure out how to loop in 
Javascript and hand it a dynamic variable name.  I tried this:

<SCRIPT language="Javascript">
        function addTotals()
                {
                i = 0
                while (i <= #GetFormInfo.RecordCount#)
                        {
                        
window.document.ExpenseForm.GrandTotalAmount.value=parseFloat(window.document.ExpenseForm.GrandTotalAmount.value)+parseFloat(eval("window.document.ExpenseForm.TotalAmount"+i+".value"));
                        i++
                        }
                }
</SCRIPT>

But it doesn't work doesn't appear to go through each variable name.  How 
would I do this?

T

______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to