Forum Moderators: open

Message Too Old, No Replies

Coldfusion - CFUPDATE

         

paseo

7:32 pm on Feb 5, 2007 (gmt 0)

10+ Year Member



Anybody in here on the up and up with coldfusion?

I have built a flash form that pulls information dynamically from a mysql db. everything but the edit feature is working. When the form is submitted, it is sent to submit.cfm. For some reason, errors appear as:

The given fieldname "DBDATA.FIRSTNAME" could not be found in the table "table".

Below is a STRIPPED down version of what we have. Is there something im doing wrong?

--SUBMIT.CFM--

<cfupdate dataSource = "datasource"
tableName = "table"
formFields = "firstname,lastname">

----------------------------------------

--FORM.CFM--

<cfquery name="dbdata" datasource="datasource">
SELECT * FROM table
</cfquery>

<cfform format="flash" action="submit.cfm">

<cfformgroup type="vbox"><cfformgroup type="panel" label="Information">

<cfgrid name="dbdata" query="dbdata" rowheaders="false">
<cfgridcolumn name="firstname" header="First Name" />
<cfgridcolumn name="lastname" header="Last Name" />

</cfgrid>
</cfformgroup>

<cfformgroup type="panel" label="Edit">
<cfinput type="text" name="firstname" label="First Name:"bind="{dbdata.selectedItem.firstname}" />
<cfinput type="text" name="lastname" label="Last Name:"bind="{dbdata.selectedItem.lastname}" />

<cfinput type="submit" name="submit" value="Apply changes" />
</cfformgroup>

</cfformgroup>
</cfform>

stajer

7:39 pm on Feb 5, 2007 (gmt 0)

10+ Year Member



Check the formfields being submitted to the cfupdate tag on submit.cfm.

cfupdate works only if your form field names match exactly the column names in your table. In your example, they look to match, but it looks from the error that your form.cfm page is submitting dbdata.firstname (NOT firstname) as the form field name.

paseo

7:42 pm on Feb 5, 2007 (gmt 0)

10+ Year Member



Eaxctly! Even though that the input "name" is the actual form field, when submitted, it attaches the name of the database query "DBDATA". Is this something to do with cfgrid not setup correctly?