Instead of this
<cfset variables.thisId = form["cyeID"&ii]/>
<cfset variables.thisRate = form["Earnings"&ii]/>
Try This:
<cfset variables.thisId = Evaluate("form.cyeID#ii#")>
<cfset variables.thisRate = Evaluate("form.Earnings#ii#")>
Do the same on your cfparam.
Mike
-----Original Message-----
From: Renee Spadaro [mailto:[EMAIL PROTECTED]
Sent: Friday, January 25, 2008 10:20 AM
To: CF-Newbie
Subject: Java object error
Hi,
I am trying to update a sql table by looping through records. I have been
reading a bunch of stuff here and tried different things but I keep getting
the same error:
Element cyeID1 is undefined in a Java object of type class
coldfusion.filter.FormScope referenced as
My code is this:
<!--- Save the data --->
<cfif form.FormAction is "Save">
<cfloop from="1" to="#form.Records#" index="ii">
<!--- Define variables --->
<cfparam name="form.#Earnings&ii#" type="integer" default="0">
<!--- Get the ID of the person and the earnings from the form --->
<cfset variables.thisId = form["cyeID"&ii]/>
<cfset variables.thisRate = form["Earnings"&ii]/>
<!--- Update each record with the new earnings --->
<cfquery name="saveData" datasource="cs-arch-apps">
UPDATE tbCalendarYearEarnings
SET Earnings = <cfqueryparam value="#variables.thisRate#"
cfsqltype="cf_sql_integer">
WHERE cyeID = <cfqueryparam value="#variables.thisId#"
cfsqltype="cf_sql_integer">
</cfquery>
</cfloop>
</cfif>
There are three pieces of data displayed on this form:
Employee Number (cyeID)
Name
Earnings (Earings)
I have a hidden field to get the row count. I've trying this with two
records just to see if it works.
Also, there is a hidden field (FormAction) which equals save.
I've been reading about java objects. Do i need to add a <cfobject> tag
here somewhere and create the java class?
Thanks for the help,
Renee
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3263
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15