Sorry if I'm repeating what others might have said...
The problem is, you're not creating the FORM variables you think you are.
Where you're looping over the query to create the form, you'll need to do
something like:
<cfoutput query="yourQuery">
<input type="text" name="earnings_#yourQuery.CurrentRow#" />
</cfoutput>
This'll then give you earning_1, earning_2, etc.
Make sense?
Adrian
http://www.adrianlynch.co.uk/
-----Original Message-----
From: Renee Spadaro
Sent: 28 January 2008 05:46
To: CF-Newbie
Subject: Re: Java object error
Hi CS,
I think I understand what you're telling me. I put the <cfdump> at the top
of the page and looking at the results I can that there is no ID1, ID2,
Earnings1, Earnings2. Instead I have ID: 57,70 and Earnings: 1234,5678.
These are consistant because they're database values. I also get submit.x
and submit.y with different values every time.
I don't know if it matters but I constructed the form inside table tags.
Rather than type this whole thing out, here's the entire thing:
<cfdump var="#FORM#">
<cfquery name="getData" datasource="cs-arch-apps">
SELECT * FROM dbo.tbCalendarYearEarnings
WHERE ProcessLevel = '#ProcessLevel#'
ORDER BY ProcessLevel, LastName
</cfquery>
<!--- Save the data --->
<cfoutput>
<cfif structKeyExists(form, "FormAction") AND form.FormAction is "Save">
<cfloop from="1" to="#form.Records#" index="ii">
<cfparam name="form.cyeID#ii#" type="integer" default="0">
<cfparam name="form.Earnings#ii#" type="integer" default="0">
<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>
<table border="1" cellpadding="2" cellspacing="2" width="100%"
class="Default">
<form action="test-page.cfm?ProcessLevel=#ProcessLevel#" method="post">
<input type="hidden" name="Records" value="#getData.recordcount#">
<input type="hidden" name="ProcessLevel" value="#ProcessLevel#">
<input type="hidden" name="FormAction" value="Save">
<tr>
<td>Lawson ID</td>
<td>Name</td>
<td>Earnings</td>
</tr>
</cfoutput>
<cfoutput query="getData">
<tr>
<td>#getData.EmployeeNo#</td>
<td>#getData.FirstName# #getData.LastName#</td>
<td><input type="text" name="Earnings"
value="#getData.Earnings#"
size="10"></td>
<td><input type="hidden" name="cyeID"
value="#getData.cyeID#"></td>
<td><input type="hidden" name="RecordID"
value="#getData.currentrow#"></td>
</tr>
</cfoutput>
</form>
</table>
<cfoutput>
<table>
<form name="Submit">
<input name="Submit" type="image"
src="/images/shared/buttons/submit.gif"
alt="Submit" border="0" value="Save">
</form>
</table>
</cfoutput>
I know it has something to do with that <cfoutput query> that gets the data
from the database but when I tried a <cfloop query> it wouldn't return any
results.
Also, I had a heck of a time getting that submit button to display under the
form instead of above it so I put in another <cfoutput> tag. I'm sure
that's not the right way to do that either.
As you can see, I am pretty clueless.
Thanks for looking at it,
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:3278
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15