Cfgridupdate error (Can't find grid)
I am trying to update some information from a datagrid, the datagrid populates from a query and works well. The problem begins when either I try to use cfgridupdate tag or when i try to update a row using POSTED form fields (Gridname.FieldName AND GridName.Original.FieldName)....
It seems like is not taking FORM FIELDS although the debugger is showing me Form Fields as follows:
Form Fields:
FIELDNAMES=SUBMIT,__CFGRID__SUBMITCHANGES__POSITIONS_GRID
POSITIONS_GRID.ACCOUNT=Array (1)
POSITIONS_GRID.ACCOUNT_NAME=Array (1)
POSITIONS_GRID.BONDTYPE=Array (1)
POSITIONS_GRID.CLIENTNAME=Array (1)
POSITIONS_GRID.COST=Array (1)
POSITIONS_GRID.DESCRIPTION=Array (1)
POSITIONS_GRID.MARKETVALUE=Array (1)
POSITIONS_GRID.MATURITY=Array (1)
POSITIONS_GRID.OPENDATE=Array (1)
POSITIONS_GRID.ORIGINAL.ACCOUNT=Array (1)
POSITIONS_GRID.ORIGINAL.ACCOUNT_NAME=Array (1)
POSITIONS_GRID.ORIGINAL.BONDTYPE=Array (1)
POSITIONS_GRID.ORIGINAL.CLIENTNAME=Array (1)
POSITIONS_GRID.ORIGINAL.COST=Array (1)
POSITIONS_GRID.ORIGINAL.DESCRIPTION=Array (1)
POSITIONS_GRID.ORIGINAL.MARKETVALUE=Array (1)
POSITIONS_GRID.ORIGINAL.MATURITY=Array (1)
POSITIONS_GRID.ORIGINAL.OPENDATE=Array (1)
POSITIONS_GRID.ORIGINAL.POSITION_ID=Array (1)
POSITIONS_GRID.ORIGINAL.QUANTITY=Array (1)
POSITIONS_GRID.ORIGINAL.UNITCOST=Array (1)
POSITIONS_GRID.POSITION_ID=Array (1)
POSITIONS_GRID.QUANTITY=Array (1)
POSITIONS_GRID.ROWSTATUS.ACTION=Array (1)
POSITIONS_GRID.UNITCOST=Array (1)
Any idea?
The following example will bring me an error when I try to update a row. (CAN'T FIND POSITIONS_GRID GRID)
And if I try accessing Arrays from the form fields It will do the same
**************************************************************** CODE ********************************************
<cfif isDefined("Submit")>
<html>
<head>
<title>Update grid values</title>
</head>
<body>
<h3>Updating grid using cfgridupdate tag.</h3>
<cfgridupdate grid="Positions_grid"
datasource="#Application.DSN#"
tablename="BS_Positions_DUMMY">
Click <a href="grid2.cfm">here</a> to display updated grid.
</body>
</html>
<cfelse>
<cfquery name="getData" datasource="#Application.DSN#">
SELECT BS_Positions_DUMMY.position_id,BS_Positions_DUMMY.import_id, BS_Positions_DUMMY.Account, BS_Positions_DUMMY.Security_Id, BS_Positions_DUMMY.Description, CONVERT(VARCHAR(20), BS_Positions_DUMMY.OpenDate, 110)
AS OpenDate, CONVERT(Money, BS_Positions_DUMMY.UnitCost) AS UnitCost, Issuer.name, CONVERT(Money, BS_Positions_DUMMY.MarketValue) AS MarketValue, BS_Positions_DUMMY.Cost,
BS_Positions_DUMMY.Quantity, EntityAccount.account_name, Accounts.del, EntityAccount.del AS Expr1, UserAccounts.relationship, UserAccounts.owner, ISNULL(Users.name,
'') + ' ' + ISNULL(Users.last_name, '') AS clientname, Users.del AS Expr3, CONVERT(VARCHAR(20),bond.maturity,110) as Maturity, CASE BS_Positions_DUMMY.ClassCode WHEN 1 THEN 'Cash' WHEN 2 THEN 'Bond' WHeN 3 THEN 'Fund' WHEN 4 THEN 'Stock' WHEN 5 THEN 'Other' END as BondType
FROM AccountEntities INNER JOIN
EntityAccount ON AccountEntities.account_id = EntityAccount.account_id INNER JOIN
BS_Positions_DUMMY INNER JOIN
bond ON BS_Positions_DUMMY.bond_id = bond.bond_id INNER JOIN
Issuer ON bond.issuer_id = Issuer.issuer_id ON EntityAccount.account = BS_Positions_DUMMY.Account INNER JOIN
Accounts ON AccountEntities.account_id = Accounts.account_id INNER JOIN
UserAccounts ON Accounts.account_id = UserAccounts.account_id INNER JOIN
Users ON UserAccounts.user_id = Users.users_id
WHERE (BS_Positions_DUMMY.import_id =
(SELECT MAX(id_importacion) AS Expr1
FROM import)) AND (Accounts.del <> 1) AND (EntityAccount.del <> 1) AND (Users.del <> 1) AND (UserAccounts.relationship = 1) AND (UserAccounts.owner = 1)
</cfquery>
<cfoutput>
<table align="center" width="95%">
<tr align="center"><td>
<cfform action="PositionsReport.cfm" name="SubmitChanges" >
<cfgrid align="absmiddle" autowidth="no" vspace="10" hspace="3" rowheaders="no" selectmode="edit" width="1200" format="flash" colheaderbold="yes" colheaderalign="center" colheaderfontsize="10" fontsize="9" textcolor="##333333" font="Arial, Helvetica, sans-serif" name="positions_grid" query="getData" height="400" appendkey="yes">
<cfgridcolumn name="position_id" header="Position" display="no">
<cfgridcolumn name="clientname" header="Client" width="170" dataalign="center" display="yes" select="no">
<cfgridcolumn name="account_name" header="Account Name" width="150" dataalign="center" display="yes" select="no">
<cfgridcolumn name="Account" header="Account" width="70" dataalign="center" display="yes" select="no">
<cfgridcolumn name="Description" header="Description" width="300" dataalign="center" display="yes" select="no">
<cfgridcolumn name="BondType" header="Type" width="50" dataalign="center" display="yes" select="no">
<cfgridcolumn name="OpenDate" header="Acquisition" width="70" dataalign="center" display="yes" select="no">
<cfgridcolumn name="Maturity" header="Maturity" width="70" dataalign="center" display="yes" select="no">
<cfgridcolumn name="UnitCost" header="Price" dataalign="center" type="currency" width="50" display="yes" select="no">
<cfgridcolumn name="Quantity" header="Quantity" dataalign="center" type="numeric" width="50" display="yes"select="no">
<cfgridcolumn name="Cost" header="Cost" dataalign="center" type="currency" width="60" display="yes"select="yes">
<cfgridcolumn name="MarketValue" select="yes" header="Market Value" type="currency" width="60" dataalign="center" display="yes"></cfgrid>
</td></tr>
<tr><td>
<cfinput type="Submit" name="Submit" value="Submit">
</td></tr>
</table>
</cfform>
</cfoutput>
</cfif>
