views:

92

answers:

1

Hello again! :o

I am working with a cfgrid and I'm not sure how to make it so when someone edits data in an entry it saves.

<cfform>
<cfgrid
name = "degrees"
query = "getDegrees"
insert = "yes"
delete = "yes"
width = "500"
height = "150"
insertButton = "New Degree"
deleteButton = "Delete Degree"
colHeaderBold = "Yes"
selectColor = "##006633"
selectMode = "edit"
>
<cfgridcolumn name = "Terminal"
values = "Yes, No" >

<cfgridcolumn name = "Degree"
values = "B, M, D"
valuesDisplay = "Bachelors, Masters, Doctorate">
<cfgridcolumn name = "Name">

<cfgridcolumn name = "Specialization">
<cfgridcolumn name = "Year">
<cfgridcolumn name = "Institution">
<cfgridcolumn name = "Transcript"
values = "Yes, No" >

</cfgrid>
</cfform>

I know there is the cfgridupdate tag but I'm unsure of where to put it. Does it submit like a regular form?

I know this is a simple question, but I couldn't find an answer that didn't use binding on the web. (Which I can't use...binding that)

Using Coldfusion 8. :) (Note: binding doesn't work due to IT department -_- )

+2  A: 

You would so something like this (from CF live docs).If the gridEntered form field exists, the form was submitted. Perform gridupdate.

<cfif IsDefined("form.gridEntered") is True>
    <cfgridupdate grid = "FirstGrid" dataSource = "cfdocexamples" Keyonly="true"
        tableName = "CourseList">
 </cfif>


<cfform>
<cfgrid name = "FirstGrid" width = "450" 
    query = "GetCourses" insert = "Yes" delete = "Yes"
    font = "Tahoma" rowHeaders = "No" 
    colHeaderBold = "Yes" 
    selectMode = "EDIT"
    insertButton = "Insert a Row" deleteButton = "Delete selected row" >
</cfgrid><br>
<cfinput type="submit" name="gridEntered">
</cfform>

Source: http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Part_3_CFML_Ref_1.html

The example code should be cleaned up a bit: Use StructKeyExists(Form,"gridEntered") over IsDefined("form.gridEntered")

Pragnesh Vaghela
thanks a bunch! :) I didn't see that on the site ><;
Bri