Okay, here's another for you.

I am (with your helpful suggestions) able to add together two dynamically named 
form fields.

Now, I need to get all of the values that have been added together, and add 
them together for one master total.

Ex.  I have N number of fields where mileageBegin and mileageEnd are added 
together to get the row total.  Now, I need to add all the row totals together 
to get the Master mileage for the week.

Here's what I'm using to get the row totals:

<cfloop index="i" from="1" to="#rowtotal#">
<cfoutput>
function dosum#i#()
{
  document.frmTalent.mileageTotal#i#.value = 
floor(parseFloat(document.temps.mileageBegin#i#.value) + 
parseFloat(document.temps.mileageEnd#i#.value))

.......

</cfoutput>
</cfloop>

Now I need to access every mileageTotal#i# field to get its subtotal so they 
can be added to get a Master total.

If these were static, this would be easy, but I'm stumped on what to do with N 
number of fields.

Ideas?

Thanks!


>Without specifics, I can give you a general example:
>
>Var objForm = document.forms[ 0 ];
>Var objInput1 = objForm.elements[ "dynamic_field_1" ]; 
>Var objInput2 = objForm.elements[ "dynamic_field_2" ];
>Var objInput3 = objForm.elements[ "dynamic_result" ];
>
>objInput3.value = (objInput1.value * 1) + (objInput2.value * 1);
>
>
>
>Of course, there is no validation here. I have to *1 to make sure that
>it KNOWS not to do string concatenation, but rather mathematical
>addition.
>
>Does that help?
>
>
>.....................
>Ben Nadel
>Certified Advanced ColdFusion MX7 Developer
>www.bennadel.com
> 
>Need ColdFusion Help?
>www.bennadel.com/ask-ben/
>
>-----Original Message-----
>From: Joel Watson [mailto:[EMAIL PROTECTED] 
>Sent: Friday, May 04, 2007 10:39 AM
>To: CF-Talk
>Subject: Add Together Values of Dyanamic Fields
>
>I have a form in which several of the fields are generated dynamically
>based on the choice of the user.
>
>I would like to be able to somehow grab the entered values of the fields
>(client-side) and add them together into another field before the form
>is submitted.  I realize that technically this is a client-side
>question, but was hoping that someone might have run across/done this
>before.
>
>Thanks!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:277413
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to