How to populate a form with data from a table

terry 25 Nov, 2016
I've found so many posts that seem to almost help me do what I need to do, but I've gotten myself totally confused!

I need to have a form that allows the user to input a record id of an existing record, then have the form present fields from the existing record they referenced and then change the contents of those fields.

I can't figure out how to read a database record after the form is presented and then fill in the existing data before the submit so that the appropriate data is changed.

Any pointers to get me to doing the correct things would be appreciated.

Thanks,
Terry
GreyHead 26 Nov, 2016
Hi Terry,

I would use a two page form - on the first page have an input box for the record ID*. On the second page use a DB Read action to get the data and display the edit form. That form needs to include a hidden input with the record ID. If the input names match the column names then CF will populate the form with the data from the table record. The when the second page is submitted use a DB Save action to update the record.

Bob

* If this is publicly available I would not use a unique random string to identify the record and not the record id. It's too easy for people to guess that if 123 is valid then so is 124, 125, . . .
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger