Skip to main content
Inspiring
February 18, 2010
Question

cfgrid insert issue

  • February 18, 2010
  • 1 reply
  • 614 views

Hi,

I am having a small issue with inserting new rows into a grid and is flaky about it, sometimes it works and sometimes it does not. Here is what appears to be happening(some of the time that is). Once the page is loaded and displaying the grid, I can press the insert button and it will expand the grid to show a blank row waiting for some data. I type the data in and hit submit and it processes the form and sends me back to grid, but does not show the new insert.

It seems that once I type in the data I need to click off of the cell and bring the focus to something else and hit submit it does seem to work, but if I press the submit button while the new cell still has the cursor focus is when it seems to mostly fail.

Any suggestions on what is exactly going on here or how to fix it? TIA.

This topic has been closed for replies.

1 reply

Inspiring
February 21, 2010

Can you pls post a small/simple, self-contained code example that demonstrates this happening?

--

Adam

rmorganAuthor
Inspiring
February 23, 2010

First page:

<cfform action="editaffiliatetypeaction.cfm" method="post">
<cfgrid name="editaffiliatetypegrid" selectmode="edit" insert="yes" insertbutton="Insert"delete="yes" deletebutton="Delete" query="getaffiliatetype">

<cfgridcolumn name="affiliatetype_id" header="affiliatetype_ID" display="no">
<cfgridcolumn name="affiliatetype" header="Affiliate Type" display="yes" width="255">

</cfgrid><br />
<cfinput type="submit" name="submit" value="submit">

</cfform>

Action page:

<CFIF IsDefined("form.editaffiliatetypegrid.rowstatus.action")>

    <CFLOOP INDEX = "Counter" FROM = "1" TO =
        #ArrayLen(form.editaffiliatetypegrid.rowstatus.action)#>

    <CFOUTPUT>
    The row action for #Counter# is:
    #form.editaffiliatetypegrid.rowstatus.action[Counter]#
    <BR><BR>
   
    </CFOUTPUT>

    <CFIF form.editaffiliatetypegrid.rowstatus.action[Counter] IS "D">
   
    <CFQUERY NAME="DeleteAffiliatetype" DATASOURCE="#dsn#">
        DELETE from affiliatetype
        WHERE affiliatetype_id=#form.editaffiliatetypegrid.original.affiliatetype_id[Counter]#
    </CFQUERY>

<CFELSEIF form.editaffiliatetypegrid.rowstatus.action[Counter] IS "U">

    <CFQUERY NAME="UpdateExistingAffiliatetype" DATASOURCE="#dsn#">
        UPDATE affiliatetype
        SET affiliatetype='#form.editaffiliatetypegrid.affiliatetype[Counter]#'
        WHERE affiliatetype_id=#form.editaffiliatetypegrid.original.affiliatetype_id[Counter]#
    </CFQUERY>

<CFELSEIF form.editaffiliatetypegrid.rowstatus.action[Counter] IS "I">

    <CFQUERY NAME="InsertNewAffiliatetype" DATASOURCE="#dsn#">
        INSERT into affiliatetype
        (affiliatetype)
        VALUES ('#form.editaffiliatetypegrid.affiliatetype[Counter]#')
    </CFQUERY>

    </CFIF>
    </CFLOOP>
</CFIF>

<cflocation url="editaffiliatetype.cfm">