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

Chapter 12. Updating a Record in the Database > Building displayParksAfter.cfm

Building displayParksAfter.cfm

The displayParksAfter.cfm page displays the updated record and contains a dynamic menu to let users edit another record. It also contains four Show Region server behaviors, which provide the user with a descriptive message if no database records are found.

1.
Create a new ColdFusion page from the bookexample template, and name it displayParksAfter.cfm.

2.
Place your cursor in the Body section of the document window, and insert a FORM tag. In the FORM tag’s Property Inspector, enter updateRecord.cfm in the Action text box, and select GET in the Method menu. This lets users select another park record to update in the dynamic menu and pass the selection to the updateRecord.cfm page as a URL variable.

3.
After making sure that your cursor rests inside the FORM tag box, insert a table with 10 rows, 4 columns, and no border.

4.
Create a recordset named parkQueryF. Like the parkQueryF recordset in confirmUpdate.cfm, this parkQueryF recordset selects all columns from the tblPark table and filters the results by the URL parameter passed by the Update Record server behavior in confirmUpdate.cfm.

5.
By entering text and creating dynamic text from the parkQueryF recordset, make the page appear similar to the one shown in Figure 12.14.

Figure 12.14. The displayParksAfter.cfm page contains dynamic text, a dynamic menu, and Show Region server behaviors.


6.
Create another recordset named parkQueryNames from the tblParks table. Select only the PARKNAME column because it is the only column required.

7.
Merge the cells in the third-to-last and last table rows. In those rows, enter the message No records found!

8.
Using your mouse, select the third table row from the bottom. Using the Server Behaviors panel, insert a Show Region if Recordset Is Empty. In the Show Region if Recordset Is Empty dialog box, select the parkQueryF recordset. A cfif tab appears around the row.

9.
Repeat the previous step for the bottom table row, except you should select the parkQueryNames recordset.

10.
In the second-to-last table row, insert a menu and a Submit button. In the menu’s Property Inspector, click the Dynamic button. Bind the Value and Display values to the PARKNAME column of the parkQueryNames recordset. The Value attribute will be passed to updateRecord.cfm as a URL variable.

11.
Using your cursor, select the table rows containing dynamic text, and insert a Show Region if Recordset is Not Empty server behavior for the parkQueryF recordset. The cfif tab appears around the rows.

12.
Using your cursor, select the row containing the dynamic menu, and insert a Show Region if RecordSet is Not Empty server behavior for the parkQueryNames recordset.

13.
Save your work.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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