Professional Web Applications Themes

Grid gridName not found - Coldfusion - Advanced Techniques

I'm fighting now for some time with <cfgridupdate> and can't get it working at all. I get always the error msg. Grid abc... not found. I tested it with CF5 and CF MX7 - no difference. As I can't see any typing error I assume the CF set-up needs a change. Also I can't find any complete example in the internet I could use for learning, alwyas only bits an pieces. Here is my example! What is wrong with it? The grid as such works I can insert, delete and change. As soon as I save the changes I get ...

  1. #1

    Default Grid gridName not found

    I'm fighting now for some time with <cfgridupdate> and can't get it working at
    all. I get always the error msg. Grid abc... not found. I tested it with CF5
    and CF MX7 - no difference. As I can't see any typing error I assume the CF
    set-up needs a change. Also I can't find any complete example in the internet I
    could use for learning, alwyas only bits an pieces. Here is my example! What is
    wrong with it?
    The grid as such works I can insert, delete and change. As soon as I save the
    changes I get the error message. Using <cfdump> shows the grid data are in the
    FORMS structure.

    <cfif IsDefined("FORM.gridEntered") is True>
    <cfgridupdate grid="UserClassGrid" dataSource="IntraUser"
    tableName="UserClass" keyOnly="Yes">
    </cfif>

    <cfquery name="qryUserClass" datasource="IntraUser" dbtype="ODBC">
    SELECT Berechtigung as Role, UserClass as UC from UserClass</cfquery>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>User Class Maintenance</title>
    </head>
    <body>

    <cfform name=UserClassForm>
    <cfgrid name="UserClassGrid" width="400"
    query="qryUserClass" insert="Yes" delete="Yes" sort="Yes"
    selectmode="EDIT"
    insertbutton="add Record"
    deletebutton="delete Record">

    <cfgridcolumn name="Role" header="Role" select="yes" width="200">
    <cfgridcolumn name="UC" header="UC" select="yes" width="40">
    </cfgrid>

    <input type="submit" name="gridEntered" value="Save Grid">

    </cfform>
    </body>
    </html>

    STEINWO1 Guest

  2. #2

    Default Re: Grid gridName not found

    Where/what was the actual error? Something from the DB engine? Did it NOT
    occur until you actually tried to change something? If so, perhaps:

    Looked thru Docs and I can't find an explicit statement (perhaps they thought
    it was too obvious), but I have to believe that you can't do CFGRIDUPDATE if
    you're aliasing the column names. The only thing they have to work with is the
    query itself and the table name. They don't have access to the true column
    names from a DB schema right? So sooner or later they'll try to build and run
    an UPDATE/INSERT with the alias names that don't exist rather than the true
    column names.

    Of course that doesn't solve your problem with UserClass being both a column
    name and a table name. What DB allowed that? if you've inherited the DB and
    can't change column names, perhaps you could construct an Updateable View and
    go against that instead.

    JMGibson3 Guest

  3. #3

    Default Re: Grid gridName not found

    dont use aliases for the fieldnames, but the actual names from the db in your grid and change input to an cfinput. I tried worked fine.
    kopjemelk Guest

  4. #4

    Default Re: Grid gridName not found

    Thank you for the hint with the alias names. I'm using MS access. To avoid all
    this possible problems. I did another example with one of the example data
    bases CompanyInfo. As simple as my previous template and - no wonder - the same
    problem.
    I can apply all changes to the grid - no problem but when I try to save
    (submit) the changes the CF Error msg. "cfgridupdate could not find the grid
    named Department. " comes up (in MX7). In CF 5 the message is "Grid Department
    not found.
    The Grid Department must be a control on the submitted form."



    <cfif IsDefined("FORM.gridEntered") is True>
    <cfgridupdate grid="Department" dataSource="CompanyInfo"
    tableName="Departmt" keyOnly="Yes">
    </cfif>

    <cfquery name="qryDept" datasource="CompanyInfo" dbtype="ODBC">
    SELECT Dept_ID, Dept_Name, Location FROM Departmt</cfquery>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title>Department Maintenance</title>
    </head>

    <body>

    <cfform name=DeptForm>
    <cfgrid name="Department" width="400" height="400"
    query="qryDept" insert="Yes" delete="Yes"
    sort="Yes" selectmode="EDIT"
    insertbutton="add Record"
    deletebutton="delete Record">
    <cfgridcolumn name="Dept_Name" header="Department" select="yes" width="200">
    <cfgridcolumn name="Location" header="Location" select="yes" width="100">
    </cfgrid>

    <cfinput type="submit" name="gridEntered" value="Save Grid">

    </cfform>
    </body>
    </html>

    STEINWO1 Guest

  5. #5

    Default Re: Grid gridName not found

    Some googling found a few suggestions:
    Make sure table has a primary key and that it is included in the Grid.
    Make sure none of the table or column names have Underscores in them.
    Other than that I'm out of idea, except that Javascript/Java Applets run at
    the Browser to support all this. Once you use the word Java case sensitivity
    comes into play, although your example spells Department the same, so that
    seems unlikely.

    JMGibson3 Guest

  6. #6

    Default Re: Grid gridName not found

    Another thought. I don't use CFGRIDUPDATE. I taught myself how to interrogate
    CFGRID's from fields so I could intercept and impose edit rules and control the
    Updates. The only other differences in my working example are that I have a
    separate action page that will CFLOCATION back after updating and that I have
    METHOD="POST" on the CFFORM. None of my available doentation tells me what
    the default METHOD is if it's left unspecified. I DO know that METHOD="GET"
    can cause huge issues when Forms are complex or lengthy, and if that's the
    default.............?.

    JMGibson3 Guest

  7. #7

    Default Re: Grid gridName not found

    Thanks again, I tried all your suggestions. Took a table without underscore,
    added and removed the primary ID. Unfortunately the result is alwyas the same.
    I added meanwhile a <cfdump var="FORM"> and found a variable indicating the
    grid is there.
    __CFGRID__DEPTFORM__DEPARTMENT and looking into this I also found the changes
    applied to the variable. AS the message says "CF doesn't find it".

    STEINWO1 Guest

  8. #8

    Default Re: Grid gridName not found

    Perhaps making Grid Name uppercase, DEPARTMENT, everywhere? I don't know. I'm
    at a loss. My Form variables also have the Grid Name converted to uppercase.
    Of course, I'm way back on 4.5 which does NOT use Java on the server side as
    does MX and couldn't care less about case when it comes to variable names.

    JMGibson3 Guest

Similar Threads

  1. Replies: 3
    Last Post: June 6th, 10:56 AM
  2. How to get a value from a grid
    By eagle in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: September 8th, 10:20 AM
  3. How to edit records in a grid that's within a grid
    By Iams in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: March 17th, 06:41 PM
  4. zero grid
    By jens mander in forum Macromedia Freehand
    Replies: 2
    Last Post: August 31st, 09:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139