Adobe COLDFUSION 9 Manual page 838

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
<!--- using cfgridcolum type="date" --->
<cfset emps = querynew("firstname,department, salary,startdate")>
<cfset queryaddrow(emps,3)>
<cfset querysetcell(emps,"firstname","Debra",1)>
<cfset querysetcell(emps,"department","Accounting",1)>
<cfset querysetcell(emps,"salary","100000",1)>
<cfset querysetcell(emps,"startdate","2009/1/1",1)>
<cfset querysetcell(emps,"firstname","Doherty",2)>
<cfset querysetcell(emps,"department","Finance",2)>
<cfset querysetcell(emps,"salary","120000",2)>
<cfset querysetcell(emps,"startdate","2005/2/21",2)>
<cfset querysetcell(emps,"firstname","Ben",3)>
<cfset querysetcell(emps,"department","Law",3)>
<cfset querysetcell(emps,"salary","200000",3)>
<cfset querysetcell(emps,"startdate","2008/03/03",3)>
<cfform name="form01">
<cfgrid format="html"
name="grid01"
selectmode="edit"
width=600
collapsible="true"
title="Employees"
autowidth="yes"
query="emps"
sort="yes"
groupField="department">
<cfgridcolumn name="FirstName" header="FirstName"/>
<cfgridcolumn name="Department" header="Department" />
<cfgridcolumn name="Salary" display=true header="Salary" type="numeric"
values="1000000,1200000" valuesdisplay="1000000,1200000"/>
<cfgridcolumn name="StartDate"
mask="Y/m/d"/>
</cfgrid>
</cfform>
For details of various types of masks that can be used, see the CFML Reference Guide.
Datehandling when the attribute mask is used in ColdFusion 9.0.1
If the attribute
is applied to a datefield column in an HTML grid, ColdFusion converts the date to an intermediate
mask
format as shown here:
MMMMM, dd yyyy HH:mms
for example,
January, 19 2005 07:35:42
This is required for proper date conversion and is applicable both when data is sent to the server (for example, when
using an onChange grid event) and when data is received from the server (for example, populating a date field in a
grid). Therefore, in some cases, users might have to format the date if they are updating a date column in the database.
Note: Date values which are NULL are sent as empty strings when the form is submitted. In such cases, set the value to
NULL explicitly while updating the date column in the database.
insert="yes" insertButton="Add Row"
display=true header="StartDate" type="date"
Last updated 8/5/2010
833

Advertisement

Table of Contents
loading

Table of Contents