3 Replies Latest reply on May 20, 2017 11:25 PM by BKBK

    CFGRID changes 2017 date to 2000 on save

    KDMC123

      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>

        • 1. Re: CFGRID changes 2017 date to 2000 on save
          haxtbh Level 4

          If this is something that was working fine but stopped after an update I would submit a bug to Adobe - https://tracker.adobe.com/ 

          • 2. Re: CFGRID changes 2017 date to 2000 on save
            WolfShade Level 4

            What is the difference in code between the original save and the edit save?

             

            There may be a bug, as haxtbh has suggested.  But it could also be something easily missed in code review.

             

            V/r,

             

            ^_^

            • 3. Re: CFGRID changes 2017 date to 2000 on save
              BKBK Adobe Community Professional & MVP

              I'm not so sure about what you mean by 'save'. Is using the submit button to save the grid a documented feature in ColdFusion? I suspect not. If indeed not, then any results you obtained with it were just accidental.

               

              Some things we know for sure. A submit action brings you back to the form page. However, you are dealing with 2 different page contexts.

               

              After the submit button is clicked, the form page currently before you is the action page. It has a different context from the submitting page, which is now the referrer. The cfform tag has an attribute, preservedata, to maintain field values after submission. Alas, the documentation says that this doesn't apply to grids.

               

              I have always thought the action to save records after an update in cfgrid is to "press the ENTER key on the keyboard". Look it up.

               

              If that is so, then you might want to try something like

               

                  <cfinput type="button" name="SaveChanges" value="Save Changes" onclick="return String.fromCharCode(13);">

               

              Here, onclick="return String.fromCharCode(13);" is my attempt to model "press the ENTER key on the keyboard". It might be wrong. Just an idea to point the direction.