• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 13. Deleting a Record in the Database > Building confirmDelete.cfm

Building confirmDelete.cfm

The confirmDelete.cfm page serves as a confirmation for users to make absolutely sure that they want to delete this record. It displays the item or items that the user selected in displayRecords.cfm. To accomplish this, you will build a recordset that filters the records by the itemID URL variable passed from displayRecords.cfm:

Create a new ColdFusion page and name it confirmDelete.cfm.

Place your cursor in the Body section, and insert a FORM tag. In the Action text box, enter displayRecordsAfter.cfm. You will create this page in the next section. In the Method menu, select POST.

Insert a table within the FORM tag box with 10 rows, 2 columns, and no border.

Create a recordset named “itemQueryFiltered”. In the Recordset dialog box, shown in Figure 13.6, select the exampleapps data source and the tblItems table. In the Columns section, click the Selected radio button and the following columns: ItemName, ItemDescription, ItemID, PartNum, CategoryIDFK, ItemCost, and Teaser. (You do not use the ItemImage column.) Filter the recordset using the itemID URL variable passed from displayRecords.cfm.

Figure 13.6. In the Recordset dialog box, you create the itemQueryFiltered recordset. You filter the recordset by the form variable passed from displayRecords.cfm.

In the right table column, insert an itemQueryFiltered recordset column value into each cell.

In the left table column, enter descriptions for each column value, such as Manufacturer ID, Item Name, and so on.

In the ninth row, insert a Submit button and a warning message, as shown in Figure 13.7. After all, there’s no going back once the button is pressed.

Figure 13.7. The finished deleteConfirm.cfm page contains a simple table with dynamic values of the record items.

In the last table row, insert the message No Records Found. Next, using the Server Behaviors panel, apply the Show Region if Recordset Is Empty server behavior for the itemQueryFiltered recordset. This row will only display if the itemQueryFiltered recordset does not contain any records.

You can also apply a Show Region if Recordset is Not Empty server behavior to the first nine rows of the table. When done, the rows will not appear unless the itemQueryFiltered recordset contains records.

Save your work.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint