Forum Moderators: open
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>
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.