Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
wespecht #1
CFGrid Problem
Hello,
I am using Coldfusion 7.01 and am having difficulty using the cfgrid to
perform an insert. I have a sql table that requires two fields (update_date
and updated_by). When I try to insert a new record through the grid, I receive
the following error:
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert the value NULL
into column 'UPDATE_DATE', table 'PSV_Diversity.dbo.tab_VENDOR_CATEGORY';
column does not allow nulls. INSERT fails
I've tried to catch these values before the <cfgridupdate...>, but still
receive the error.
Any help or insight would be greatly appreciated.
Thanks in advance,
wes
wespecht Guest
-
CFGRID in ACCORDION Problem
I am attempting to display a CFGRID on pages of an ACCORDION. The following code builds the ACCORDION pages properly but does not display the GRID.... -
cfgrid and comma problem!
Hello, this is my code hello cedric !! <cfgrid name="test_grid" selectmode="single"> <cfgridcolumn name="remarques" header="Transaction No">... -
Problem with javascript for < CFGRID>
I have a <cfgrid> thing that used to work in Coldfusion 4.5/Win NT. HAve recently moved to Coldfusion MX 6.1/Win 2003. Now all it gives me is a... -
I am desperate. cfgrid populate problem
I am preparing some intranet application. I want to hide customers CCnumber and list only last 4 digit. But I don't want this in input text. I just... -
onchage, CFGRID & TAB problem. CFMX7
Hi, anyone help me. Update a cfgrid query who is inside a tab page when user select a colum in another cfgrid?? Case: The same flash form... -
OldCFer #2
Re: CFGrid Problem
I'm not sure this appliies to cfgrid, but it does to other cfform fields using
the
"_Date" as the name of a field. CF will ignore those fields because the
"_Date"
field name notation is for validation. Try changing the DB name, and grid field
name to "InsertDate", with no space.
OldCFer Guest
-
wespecht #3
Re: CFGrid Problem
Thank you. I fumbled through it and figured it out. Here is what I did:
Since the user can make multiple changes (inserts, updates, deletions) at one
time, the grid stores these actions in
an array. I loop through the action array and perform any necessary actions
before the update is performed. All works
fine now.
<cfif isdefined("form.gridentered") eq true>
<cfloop index = "Counter" from = "1" to =
#arraylen(Form.my_grid.rowstatus.action)#>
<cfoutput>
<!--- MAKE SURE THE USER HAS ENTERED A VALUE (REQUIRED) --->
<cfif #form.my_grid.DESCRIPTION[Counter]# neq "">
<!--- ON INSERT, NEED TO PROVIDE ADDITIONAL DATE (REQUIRED FIELDS) --->
<cfif #Form.my_grid.rowstatus.action[Counter]# eq "I">
<cfset #form.my_grid.ADD_DATE[Counter]#=#dateformat(now(), "mm/dd/yy")#>
<cfset #form.my_grid.ADD_BY[Counter]#=#variables.AUTHUSER#>
<cfset #form.my_grid.CHG_DATE[Counter]#=#dateformat(now(), "mm/dd/yy")#>
<cfset #form.my_grid.CHG_BY[Counter]#=#variables.AUTHUSER#>
<!--- ON UPDATE, NEED TO UPDATE THE DATE/WHO UPDATED FIELDS --->
<cfelseif #Form.my_grid.rowstatus.action[Counter]# eq "U">
<cfset #form.my_grid.CHG_DATE[Counter]#=#dateformat(now(), "mm/dd/yy")#>
<cfset #form.my_grid.CHG_BY[Counter]#=#variables.AUTHUSER#>
<!--- ON DELETE, DO NOT NEED TO ANYTHING --->
<cfelseif #Form.my_grid.rowstatus.action[Counter]# eq "D">
<!--- deletion code (if necessary) --->
<cfelse>
<center><b>Please insert, update or delete a record to
continue.</b></center><br><br>
</cfif>
<cfelse>
<!--- MISSING A REQUIRED FIELD ENTRY --->
<center><b>Please provide a category description for row
#Counter#</b></center>
</cfif>
</cfoutput>
</cfloop>
<cfgridupdate grid="my_grid" datasource="DataSourceName"
tablename="tableName" keyonly="no">
</cfif>
wespecht Guest



Reply With Quote

