Copy link to clipboard
Copied
I have a form fields that I built with CFLOOP from data in my database. Here is my problem the table has an ID field for each record, there is also a comment_ID field so that I can keep them grouped however each of the added comments are in a new record. I have an update form built and I want them to be able to click the update button and update each of the comments fields for that topic (hence the comment_ID) the update would have to be by the comment_ID and ID. I am not sure how to do this, do I need a CFLOOP statement or what? Anyone have any ideas or a sample would be great.
Note I am using FileMaker as my DB
Copy link to clipboard
Copied
Each form field would have to identify both the id and comment_id values in it's name somehow. Something like
field_#id#_#comment_id#
Then you're in business.
Copy link to clipboard
Copied
Um, I don't think <cfupdate> is going to be of much use to you here. It's really only designed to take form values corresponding to columns in one record in the DB. Plus it's just a hack of a tag anyhow. Bleah.
Submit your form to an action page, and on the action page do a <cfdump> of the form scope so you know what sort of data you are passing. If you're submitting data destined for multiple records, then - yeah - you probably will have to contrive your form field names so they can be looped over and sets of fields can be identified as belonging to a specific record. And then use <cfquery> on each set of form fields to perform an update query for the given record.
--
Adam