Creating a URL parameter for update links (ColdFusion)

Creating a URL parameter for update links (ColdFusion)

The links on the results page (see Creating the links to open the update page (ColdFusion)) not only have to open the update page, they must pass the ID of the record the user selected. The update page will use this ID to find the requested record in the database and display it.

The record ID is passed to the update page in a URL parameter. For more information, see URL parameters.

This section describes how to create a URL parameter that passes a record ID to the update page.

To create the URL parameter:

  1. Select the link on the results page.
  2. In the Link text box in the Property inspector, add the following string at the end of the URL:
    ?recordID=#recordsetName.fieldName#
    

    The question mark tells the server that what follows is one or more URL parameters. The word recordID is the name of the URL parameter (you can make up any name you like). Make a note of the name of the URL parameter because you'll use it in the update page later.

    The expression after the equal sign is the value of the parameter. In this case, the value is generated by a ColdFusion expression that returns a record ID from the recordset. A different ID is generated for each row in the dynamic table. In the ColdFusion expression, replace recordsetName with the name of your recordset, and replace fieldName with the name of the field in your recordset that uniquely identifies each record. In most cases, the field will consist of a record ID number. In the following example, the field consists of unique location codes.

    locationDetail.cfm?recordID=#rsLocations.CODE#
    

    When the page runs, the values of the recordset’s CODE field are inserted in the corresponding rows in the dynamic table. For example, if the Canberra, Australia, rental location has the code CBR, then the following URL will be used in the Canberra row in the dynamic table:

    locationDetail.cfm?recordID=CBR
    
  3. Save the page.

The next step is to modify the update page so that it can find the requested record in the database and display it on the page. See Retrieving the record to update (ColdFusion).



Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Developing Applications Rapidly
Building ColdFusion Applications Rapidly
Reference
Building ASP.NET Applications Rapidly
Building ASP and JSP Applications Rapidly
 
ASPTreeView.com
 
Evaluation has ФЪБШДФЦїУПexpired.
Info...