2 Replies Latest reply on Jan 3, 2014 3:24 PM by mdwyerco

    Does cfgrid in v10 really return valid data in the form array?

    mdwyerco

      My evidence shows this as incredibly buggy. Other forum discussions (http://forums.adobe.com/message/2868996) from 2010 and v9 and others suggest this tag has always been crap. The unproven workaround suggestions in the discussion mentioned are not even hinted at in the officical documentation.

       

      Should I even bother trying to make this tag work, or just find another way to allow my users to edit their data?

        • 1. Re: Does cfgrid in v10 really return valid data in the form array?
          Anit_Kumar Adobe Employee

          Hello mdwyerco,

           

          cfgrid works fine for us. Do you have an sample code, which might be causing the issue for you. You can share the same, and we can test it, if it's not functioning as expected.

           

          Regards,

          Anit Kumar

          • 2. Re: Does cfgrid in v10 really return valid data in the form array?
            mdwyerco Level 1

            Glad to.

             

            First of all, create a table in an Access database:

                      MDSESSIONS (

                      ID Autonumber,

                      SessName default alphanumeric datatype,

                      SessDesc default alphanumeric datatype

                      )

             

            Populate 3 rows with SessName only, ID assigned by Access, SessDesc empty:

                      Dairy Goats (ID = 2)

                      Beekeeping (ID = 3)

                      Chickens (ID = 4)

             

            EDITGRID.CFM

            <cfquery name="getStuff" datasource="utility">

                      select id, sessname, sessdesc

                      from mdsessions

                      order by id

            </cfquery>

             

            <html>

            <head>

                      <title>Edit Sessions</title>

            </head>

             

            <body><br>

             

            <cfform action="editpost.cfm" method="POST" format="html" target="_blank">

            <cfgrid name="stuff" query="getStuff" selectmode="EDIT" format="html">

                      <cfgridcolumn name="id" display="yes">

                      <cfgridcolumn name="sessname" width="300">

                      <cfgridcolumn name="sessdesc" width="300">

            </cfgrid>

            <br><cfinput type="submit" value="Post The Changes" name="submit">

            </cfform>

             

            <br></body>

            </html>

             

            EDITPOST.CFM

            <html>

            <head>

                      <title>Edit Array</title>

            </head>

             

            <body>

             

            <cfif structKeyExists(form,"submit")>

                      <cfloop index = "counter" from = "1" to = #arraylen(Form.stuff.rowstatus.action)#>

                                <cfoutput>

                                Row #counter#

                                Action = #Form.stuff.rowstatus.action[counter]#

                                ID = #Form.stuff.id[counter]#

             

              <cfif #Form.stuff.original.sessname[counter]# neq #Form.stuff.sessname[counter]#>

                Name changes from #Form.stuff.original.sessname[counter]#

                                                           to #Form.stuff.sessname[counter]#

              </cfif>

             

              <cfif #Form.stuff.original.sessdesc[counter]# neq #Form.stuff.sessdesc[counter]#>

                Description changes from #Form.stuff.original.sessdesc[counter]#

                     to   #Form.stuff.sessdesc[counter]#

                                </cfif>

                                </cfoutput>

                                <br>

                      </cfloop>

            <cfelse>

                      No form data

            </cfif>

             

            <cfdump var="#form#">

             

            </body>

            </html>

             

            EditGrid.CFM displays 3 rows, in ID sequence: 2, 3, 4.

             

            Click in the description for the 1st row and enter "a".

            Click in the description for the 2nd row and enter "b".

            Click in the description for the 3rd row and enter "c".

             

            Click the [Post The Changes] button, and EditPost.CFM will load in a new tab/window.

             

            EditPost.CFM displays two rows, not three:

            Row 1 Action = U ID = 3 Description changes from to a

            Row 2 Action = U ID = 4 Description changes from to c

             

            So the ID's are wrong, and the description 'b' is not even represented in the form array.

             

            Thanks!