tracker issue : CF-4198737

select a category, or use search below
(searches all categories and all time range)
Title:

CFGRID changes 2017 date to 2000 on save

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/CannotReproduce

Reporter/Name(from Bugbase): neal cooper / neal cooper ()

Created: 05/19/2017

Components: CFForm, HTML

Versions: 2016

Failure Type: Data Corruption

Found In Build/Fixed In Build: Update 4 /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Win 2012 Server x64

Vote Count: 0

Problem Description:
We're using ColdFusion 2016 Update 4
 
This problem was just brought to my attention by a user who probably has not used her application since Update 4 was applied.

The application worked fine until reported to me on 5/19/17 our update was applied on 4 /25/17.

I've attached screenshots at the bottom of this post.

 

The workflow is the user enters a new event hits save - that's it

But now after the first save she has to go to edit mode and change the 00 to 17 and save again. 

The change sticks after the edit, but we need to find a fix for this.

 

 

here is the code:

 

        <cfform class="EMwrapper" name="MainForm" format="html">
            <cfgrid name="gridEM"
                    query="EM"
                    format="html"
                    selectmode="edit"
                    enabled="yes"
                    insert="yes"
      delete="yes"
                    height="400"
                    autowidth="yes">
  
  <cfgridcolumn name="ID">
  <cfgridcolumn name="EventNum">
  <cfgridcolumn name="EventTitle">
  <cfgridcolumn name="EventDate" mask="m/d/y" type="Date">
  <cfgridcolumn name="EventLocation">
  <cfgridcolumn name="CountyCode">
  <cfgridcolumn name="Hours">
  <cfgridcolumn name="HealthRelated">

            </cfgrid>
            
            <cfinput type="submit" name="SaveChanges" value="Save Changes">
        </cfform>







Steps to Reproduce:
make new entry
Actual Result:
2017 becomes 2000
Expected Result:
2017
Any Workarounds:
Submit, Edit, Save

Attachments:

Comments:

Neal, I don't see any attachments with this bug report. The test code that you've shared seems to be missing the query "EM". How are you processing the information posted by the form when the user hits the save button, so that the grid displays the new updated information? And I was not able to the observe issue with an arbitrary query I used with the test code at the end of this note. Hitting the save button after. inserting a new row dumps the date in the following format: Tue May 23 2017 00:00:00 GMT+0530 (India Standard Time) I'm on CF2016.0.04.302561. Can you share the information suggested at the begining of this note. Test Code: <cfscript> qry = queryNew("ID,EventNum,EventTitle,EventDate,EventLocation", "", [ {ID=1, EventNum=1, EventTitle="Memo1", EventDate="2/07/1971", EventLocation="sochi"}, {ID=2, EventNum=12, EventTitle="Memo2", EventDate="12/07/1983", EventLocation="la paz"}, {ID=3, EventNum=13, EventTitle="Memo3", EventDate="3/21/2017", EventLocation="calais"} ]); if(isDefined("form.SaveChanges")) writeDump(form.GRIDEM.EVENTDATE[1]); </cfscript> <cfform class="EMwrapper" name="MainForm" format="html"> <cfgrid name="gridEM" query="qry" format="html" selectmode="edit" enabled="yes" insert="yes" delete="yes" height="400" autowidth="yes"> <cfgridcolumn name="ID"> <cfgridcolumn name="EventNum"> <cfgridcolumn name="EventTitle"> <cfgridcolumn name="EventDate" mask="m/d/y" type="Date"> <cfgridcolumn name="EventLocation"> </cfgrid> <cfinput type="submit" name="SaveChanges" value="Save Changes"> </cfform>
Comment by Piyush K.
711 | May 23, 2017 07:36:12 AM GMT
Ok, I'm attaching the entire document with the cfc see if you can find my error. edit file code: <cfparam name="Cookie.CurrentName" default=""> <cfparam name="Cookie.CurrentID" default=""> <cfparam name="EventNum" default= 0 > <cfparam name="gridDisplay" default="0"> <cfparam name="btnValue" default=""> <CFIF IsDefined("form.SaveChanges") is True> <CFGRIDUPDATE GRID="gridVolData" DATASOURCE="CHT" TABLENAME="VolunteerData" KEYONLY="Yes"> </CFIF> <cfquery name="VolData" datasource="CHT"> SELECT * FROM VOLUNTEERDATA ORDER BY EventNum, Employee ASC </cfquery> <cfset gridDisplay = 1> <cfquery name="EM" datasource="CHT"> SELECT * FROM EventMaster ORDER BY EventNum ASC </cfquery> <!--- <cfquery name="EL" datasource="CHT"> SELECT * FROM EventMaster ORDER BY EventDate DESC </cfquery> ---> <!-- This area responds to the button bar clicks --> <cfif isDefined('form.EnterHours') is True> <cfset btnValue = 'EnterHours'> <cflocation url="EnterHours.cfm"> </cfif> <cfif isDefined('form.EnterEvents') is True> <cfset btnValue = 'EnterEvents'> <cflocation url="EnterEvents.cfm"> </cfif> <cfif isDefined('form.PrintRpt') is True> <cflocation url="Reports.cfm"> </cfif> <cfif isDefined('form.Logout') is True> <cfset btnValue = 'Logout'> <cfset #Cookie.CurrentName# = ''> <cfset #Cookie.CurrentID# = ''> <cflocation url="index.cfm"> </cfif> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Edit Hours</title> <link href="css/main.css" rel="stylesheet" type="text/css" /> </head> <body> <div style="text-align:center; font-size:24px">Community Hours Tracker</div> <div>Current user: <cfoutput>#Cookie.CurrentName#</cfoutput></div> <div class="btnBar"> <cfform name="btnBar"> <cfinput type="submit" name="EnterHours" value="Enter Hours" />&nbsp;&nbsp; <cfinput type="submit" name="EnterEvents" value="Enter Events" /> &nbsp;&nbsp; <cfinput type="submit" name="PrintRpt" value="Reports" /> &nbsp;&nbsp; <cfinput type="submit" name="Logout" value="Logout" /> </cfform> </div> <hr /> <div class="EMwrapper"> <!--- Find an event: <form name="SelectEvent"> <select name="EventNnum"> <option value="">--</option> <cfoutput query="EL"> <option value="#EL.EventNum#">#EL.EventNum# - #EL.EventTitle#</option> </cfoutput> </select> </form> ---> </div> <cfif #gridDisplay# EQ 1> <div class="EditWrapper">EDIT Hours</div> <br /> <cfform class="EMwrapper" name="MainForm" format="html"> <cfgrid name="gridVolData" query="VolData" format="html" selectmode="edit" enabled="yes" insert="yes" delete="yes" height="400" autowidth="yes"> <!--- <cfgridcolumn display="yes" header="Employee" name="Employee"> <cfgridcolumn display="yes" header="EventNum" name="EventNum"> <cfgridcolumn display="yes" header="PFPLevel" name="PFPLevel"> <cfgridcolumn display="yes" header="Hours" name="Hours"> ---> </cfgrid> <cfinput type="submit" name="SaveChanges" value="Save Changes"> </cfform> <!-- </cfif> --> </body> </html> cfc code: <cfcomponent> <!-- This funcion provides a list of all employees for the leadership email report --> <cffunction name="LeadershipEmail" access="public" returntype="query" output="no"> <cfquery name="LeadershipEmailList" datasource="LawProd"> Select LSLMDB.ls_apps.DEPTCODE.DEPARTMENT AS "Cost Center", LSLMDB.ls_apps.DEPTCODE.NAME AS "Department Name", LSLMDB.ls_apps.EMPLOYEE.EMPLOYEE, LSLMDB.ls_apps.EMPLOYEE.LAST_NAME, LSLMDB.ls_apps.EMPLOYEE.NICK_NAME, LSLMDB.ls_apps.EMPLOYEE.EMAIL_ADDRESS, LSLMDB.ls_apps.EMPLOYEE.JOB_CODE, LSLMDB.ls_apps.JOBCODE.JOB_CLASS, LSLMDB.ls_apps.EMSTATUS.DESCRIPTION From LSLMDB.ls_apps.EMPLOYEE Inner Join LSLMDB.ls_apps.DEPTCODE ON LSLMDB.ls_apps.EMPLOYEE.DEPARTMENT = LSLMDB.ls_apps.DEPTCODE.DEPARTMENT Inner Join LSLMDB.ls_apps.EMSTATUS ON LSLMDB.ls_apps.EMPLOYEE.EMP_STATUS = LSLMDB.ls_apps.EMSTATUS.EMP_STATUS Inner Join LSLMDB.ls_apps.JOBCODE ON LSLMDB.ls_apps.EMPLOYEE.JOB_CODE = LSLMDB.ls_apps.JOBCODE.JOB_CODE Where LSLMDB.ls_apps.EMSTATUS.DESCRIPTION like 'Active%' <!--- AND LSLMDB.ls_apps.JOBCODE.JOB_CLASS IN ('EXE','MGR','SUP') AND LSLMDB.ls_apps.EMPLOYEE.EMAIL_ADDRESS IS NOT NULL ---> OR LSLMDB.ls_apps.EMSTATUS.DESCRIPTION like 'Inter%' <!--- AND LSLMDB.ls_apps.JOBCODE.JOB_CLASS IN ('EXE','MGR','SUP') AND LSLMDB.ls_apps.EMPLOYEE.EMAIL_ADDRESS IS NOT NULL---> </cfquery> <cfset AllLeaders = #LeadershipEmailList# > <cfreturn AllLeaders> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <!-- This function is used to validate active employees attempting to login --> <cffunction name="ActiveEmpCheck" access="public" returntype="numeric" output="no"> <cfargument name="Employee" type="numeric" required="yes"> <cfquery name="ActiveEmpList" datasource="LawProd"> Select LSLMDB.ls_apps.DEPTCODE.DEPARTMENT AS "Cost Center", LSLMDB.ls_apps.DEPTCODE.NAME AS "Department Name", LSLMDB.ls_apps.EMPLOYEE.EMPLOYEE, LSLMDB.ls_apps.EMPLOYEE.LAST_NAME, LSLMDB.ls_apps.EMPLOYEE.NICK_NAME, LSLMDB.ls_apps.EMPLOYEE.EMAIL_ADDRESS, LSLMDB.ls_apps.EMSTATUS.DESCRIPTION From LSLMDB.ls_apps.EMPLOYEE Inner Join LSLMDB.ls_apps.DEPTCODE ON LSLMDB.ls_apps.EMPLOYEE.DEPARTMENT = LSLMDB.ls_apps.DEPTCODE.DEPARTMENT Inner Join LSLMDB.ls_apps.EMSTATUS ON LSLMDB.ls_apps.EMPLOYEE.EMP_STATUS = LSLMDB.ls_apps.EMSTATUS.EMP_STATUS Where LSLMDB.ls_apps.EMSTATUS.DESCRIPTION like 'Active%' AND LSLMDB.ls_apps.EMPLOYEE.EMPLOYEE = #Employee# OR LSLMDB.ls_apps.EMSTATUS.DESCRIPTION like 'Inter%' AND LSLMDB.ls_apps.EMPLOYEE.EMPLOYEE = #Employee# </cfquery> <cfset ActiveEmp = #ActiveEmpList.Employee# > <cfreturn ActiveEmp> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <!-- This funcion provides a list of all employees for the total hour report --> <cffunction name="AllEmployee" access="public" returntype="query" output="no"> <cfquery name="AllEmpList" datasource="LawProd"> Select LSLMDB.ls_apps.DEPTCODE.DEPARTMENT AS "Cost Center", LSLMDB.ls_apps.DEPTCODE.NAME AS "Department Name", LSLMDB.ls_apps.EMPLOYEE.EMPLOYEE, LSLMDB.ls_apps.EMPLOYEE.LAST_NAME, LSLMDB.ls_apps.EMPLOYEE.NICK_NAME, LSLMDB.ls_apps.EMPLOYEE.EMAIL_ADDRESS, LSLMDB.ls_apps.EMSTATUS.DESCRIPTION From LSLMDB.ls_apps.EMPLOYEE Inner Join LSLMDB.ls_apps.DEPTCODE ON LSLMDB.ls_apps.EMPLOYEE.DEPARTMENT = LSLMDB.ls_apps.DEPTCODE.DEPARTMENT Inner Join LSLMDB.ls_apps.EMSTATUS ON LSLMDB.ls_apps.EMPLOYEE.EMP_STATUS = LSLMDB.ls_apps.EMSTATUS.EMP_STATUS </cfquery> <cfset AllEmp = #AllEmpList# > <cfreturn AllEmp> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <!-- This funcion provides a list of all employees for the total hour report --> <cffunction name="EmpName" access="public" returntype="string" output="no"> <cfargument name="Employee" type="string" required="yes"> <cfquery name="Emp" datasource="LawProd"> Select LSLMDB.ls_apps.DEPTCODE.DEPARTMENT AS "Cost Center", LSLMDB.ls_apps.DEPTCODE.NAME AS "Department Name", LSLMDB.ls_apps.EMPLOYEE.EMPLOYEE, LSLMDB.ls_apps.EMPLOYEE.LAST_NAME, LSLMDB.ls_apps.EMPLOYEE.NICK_NAME, LSLMDB.ls_apps.EMPLOYEE.EMAIL_ADDRESS, LSLMDB.ls_apps.EMSTATUS.DESCRIPTION From LSLMDB.ls_apps.EMPLOYEE Inner Join LSLMDB.ls_apps.DEPTCODE ON LSLMDB.ls_apps.EMPLOYEE.DEPARTMENT = LSLMDB.ls_apps.DEPTCODE.DEPARTMENT Inner Join LSLMDB.ls_apps.EMSTATUS ON LSLMDB.ls_apps.EMPLOYEE.EMP_STATUS = LSLMDB.ls_apps.EMSTATUS.EMP_STATUS Where LSLMDB.ls_apps.EMPLOYEE.EMPLOYEE = #Employee# </cfquery> <cfset EmpName = trim(#Emp.Nick_Name#) & ' ' & trim(#Emp.Last_Name#) > <cfreturn EmpName> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <!-- This function recovers detailed report data for indviduals to view on screen or print--> <cffunction name="Details" access="public" returntype="query" output="no"> <cfargument name="Employee" type="numeric" required="yes"> <cfquery name="DetailRpt" datasource="CHT"> SELECT * FROM DetailReport WHERE Employee = #Employee# </cfquery> <cfset DetailReport = #DetailRpt# > <cfreturn DetailReport> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <!-- This function validates Administrators --> <cffunction name="Admin" access="public" returntype="query" output="no"> <cfargument name="Employee" type="numeric" required="yes"> <cfquery name="Admin" datasource="CHT"> SELECT * FROM Security WHERE (((Security.Employee)=#Employee#) AND ((Security.Active)=1)); </cfquery> <cfif #Admin.Employee# EQ #Employee#> <cfset #Cookie.CurrentID# = #Admin.Employee#> <cfset #Cookie.CurrentName# = trim(#Admin.Nick_Name#) & ' ' & trim(#Admin.Last_Name#)> </cfif> <cfset AdminUser = #Admin# > <cfreturn AdminUser> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <cffunction name="PFP5" access="public" returntype="numeric" output="no"> <cfargument name="Employee" type="numeric" required="yes"> <cfquery name="p5" datasource="CHT"> SELECT * FROM PFP5FINAL WHERE EMPLOYEE = #EMPLOYEE# </cfquery> <cfset PFP5 = #P5.recordcount# > <cfreturn PFP5> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <cffunction name="PFP4" access="public" returntype="numeric" output="no"> <cfargument name="Employee" type="numeric" required="yes"> <cfquery name="p4" datasource="CHT"> SELECT * FROM PFP4FINAL WHERE EMPLOYEE = #EMPLOYEE# </cfquery> <cfset PFP4 = #P4.recordcount# > <cfreturn PFP4> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <cffunction name="PFP3" access="public" returntype="numeric" output="no"> <cfargument name="Employee" type="numeric" required="yes"> <cfquery name="p3" datasource="CHT"> SELECT * FROM PFP3FINAL WHERE EMPLOYEE = #EMPLOYEE# </cfquery> <cfset PFP3 = #P3.recordcount# > <cfreturn PFP3> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <cffunction name="PFP2" access="public" returntype="numeric" output="no"> <cfargument name="Employee" type="numeric" required="yes"> <cfquery name="p2" datasource="CHT"> SELECT * FROM PFP2FINAL WHERE EMPLOYEE = #EMPLOYEE# </cfquery> <cfset PFP2 = #P2.recordcount# > <cfreturn PFP2> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <!-- This function recovers detailed report data from Detail_IHT--> <cffunction name="DetailIHT" access="public" returntype="query" output="no"> <cfargument name="Employee" type="numeric" required="yes"> <cfquery name="DIHT" datasource="CHT"> SELECT * FROM Detail_IHT WHERE Employee = #Employee# </cfquery> <cfset D_IHT = #DIHT# > <cfreturn D_IHT> </cffunction> <!-- ---------------------------------------------------------------------------------------------- --> <!--- <!-- This function is used to generate an automatic email list --> <cffunction name="AllEmpEmail" access="public" returntype="query" output="no"> <!--- <cfargument name="Employee" type="numeric" required="yes"> ---> <cfquery name="EmpEmailList" datasource="LawProd"> Select LSLMDB.ls_apps.DEPTCODE.DEPARTMENT AS "Cost Center", LSLMDB.ls_apps.DEPTCODE.NAME AS "Department Name", LSLMDB.ls_apps.EMPLOYEE.EMPLOYEE, LSLMDB.ls_apps.EMPLOYEE.LAST_NAME, LSLMDB.ls_apps.EMPLOYEE.NICK_NAME, LSLMDB.ls_apps.EMPLOYEE.EMAIL_ADDRESS, LSLMDB.ls_apps.EMPLOYEE.JOB_CODE, LSLMDB.ls_apps.JOBCODE.JOB_CLASS, LSLMDB.ls_apps.EMSTATUS.DESCRIPTION From LSLMDB.ls_apps.EMPLOYEE Inner Join LSLMDB.ls_apps.DEPTCODE ON LSLMDB.ls_apps.EMPLOYEE.DEPARTMENT = LSLMDB.ls_apps.DEPTCODE.DEPARTMENT Inner Join LSLMDB.ls_apps.EMSTATUS ON LSLMDB.ls_apps.EMPLOYEE.EMP_STATUS = LSLMDB.ls_apps.EMSTATUS.EMP_STATUS Inner Join LSLMDB.ls_apps.JOBCODE ON LSLMDB.ls_apps.EMPLOYEE.JOB_CODE = LSLMDB.ls_apps.JOBCODE.JOB_CODE <!--- Remove the where statement when going live Where LSLMDB.ls_apps.EMSTATUS.DESCRIPTION like 'Active%' AND LSLMDB.ls_apps.EMPLOYEE.EMPLOYEE = '10011013' OR LSLMDB.ls_apps.EMSTATUS.DESCRIPTION like 'Inter%' AND LSLMDB.ls_apps.EMPLOYEE.EMPLOYEE = '10011013' ---> </cfquery> <cfset EmailList = #EmpEmailList# > <cfreturn EmailList> </cffunction> ---> </cfcomponent>
Comment by neal c.
712 | May 23, 2017 01:10:59 PM GMT
Thanks Neal, that's a lot of code. What I can glean from it, is that you are using cfgridupdate. That was missing the what you shared originally. Here's what I tried. I have a mySQL based DSN that has the following fields CREATE TABLE doj ( id MEDIUMINT NOT NULL, joiningdate DATE NOT NULL, PRIMARY KEY (id) ); I have a grid in the test code below, that attaches to the table above. <cfscript> if(isDefined("form.SaveChanges")) cfGridUpdate(grid="gridEM", dataSource="employees", keyonly=true, tableName="doj"); </cfscript> <cfquery name = "getDates" dataSource = "employees"> SELECT ID, joiningdate FROM doj </cfquery> <cfdump var=#getDates# abort="false"> <cfform class="EMwrapper" name="MainForm" format="html"> <cfgrid name="gridEM" query="getDates" format="html" selectmode="edit" enabled="yes" insert="yes" delete="yes" height="400" autowidth="yes"> <cfgridcolumn name="ID"> <cfgridcolumn name="joiningdate" mask="m/d/y" type="Date"> </cfgrid> <cfinput type="submit" name="SaveChanges" value="Save Changes"> </cfform> If I insert a new record by clicking on the insert button and selecting a date from the date UI control, or edit a date in an existing record, again by clicking on the date UI control, the DB table updated with the correct year. What am I missing here. I don't see any screen-shots attached to this bug report. Can you pls. narrow down the issue that you are observing to a simple test code which I can use at my end by plugging in a DSN?
Comment by Piyush K.
713 | August 07, 2017 07:39:10 AM GMT
Neal, Can you pls. share the information requested in my previous note.
Comment by Piyush K.
714 | August 23, 2017 08:31:20 AM GMT