The val() function returns an integer. Text cannot be converted to an
integer and will output a 0.

~Brad

-----Original Message-----
From: Les Mizzell [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 08, 2006 4:44 PM
To: CF-Talk
Subject: Looping through Fields

When testing, form is sending...
strNAME1, numCOST1 (test values Bob, 300)
strNAME2, numCOST2 (test values John, 400)
strNAME3, numCOST3 (test values Robert, 500)
.....and however many total there my be as defined by
#form.intTravelerCount#

I've done a cfdump and confirmed that the fields are getting to the 
processing page, but when I try to loop through them like:


<cfloop index="i" from="1" to="#form.intTravelerCount#">
#Val(form["strName" & i])#  - $#Val(form["numCost" & i])#.00<br />
</cfloop>

I'm getting:

0, 300
0, 400
0, 500

Why the heck am I getting "0" for the strName. Should be showing the 
contents of the field, strName1, which is correct in the cfdump.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239864
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to