After completing the page listing the records (see Creating a URL parameter to pass to the confirmation page (ColdFusion)), switch to the confirmation page. The confirmation page shows the record and asks the user if they're sure they want to delete it. When the user confirms the operation by clicking the form button, the web application deletes the record from the database.
Building this page consists of creating an HTML form, retrieving the record to display in the form, displaying the record in the form, and adding the logic to delete the record from the database. Retrieving and displaying the record consists of defining a recordset to hold a single record--the record the user wants to delete--and binding the recordset columns to the form. The steps are outlined in more detail below.
You specified a confirmation page when you created the Delete link in the previous section. Use this name when saving the file for the first time (for example, deleteConfirm.cfm).
The hidden form field is required to store the record ID passed by the URL parameter. To add a hidden field, place the insertion point in the form and select Insert > Form > Hidden Field.
The user will click the button to confirm and delete the displayed record. To add a button, place the insertion point in the form and select Insert > Form > Button.
The simple Recordset dialog box appears. If the advanced Recordset dialog box appears instead, click Simple to switch to the simple Recordset dialog box.
To display only some of the records fields, click Selected and choose the desired fields by Control-clicking (Windows) or Command-clicking (Macintosh) them in the list.
Make sure to include the record ID field even if you won't be displaying it.
For example, if the URL used to open the confirmation page included the suffix confirmDelete.cfm?recordID=CBR, then enter recordID.
The Recordset dialog box should look as follows.
The recordset appears in the Bindings panel.
Make sure you insert this read-only dynamic content within the form boundaries. For more information on insert dynamic content in a page, see Making text dynamic.
Next, you must bind the record ID column to the hidden form field.
The hidden form field is selected.
The Dynamic Data dialog box appears.
In the following example, the record ID column selected is CODE.
The completed confirmation page should look similar to the following.
After displaying the record on the confirmation page, the next step is to add logic to delete the record. See Adding logic to delete the record (ColdFusion).