User Guide Cancel

Building record delete pages in Dreamweaver

  1. Dreamweaver User Guide
  2. Introduction
    1. Responsive web design basics
    2. What's new in Dreamweaver
    3. Web development using Dreamweaver - An Overview
    4. Dreamweaver / Common Questions
    5. Keyboard shortcuts
    6. Dreamweaver system requirements
    7. Feature summary
  3. Dreamweaver and Creative Cloud
    1. Synchronize Dreamweaver settings with Creative Cloud
    2. Creative Cloud Libraries in Dreamweaver
    3. Using Photoshop files in Dreamweaver
    4. Work with Adobe Animate and Dreamweaver
    5. Extract web-optimized SVG files from Libraries
  4. Dreamweaver workspaces and views
    1. The Dreamweaver workspace
    2. Optimize Dreamweaver workspace for visual development
    3. Search files based on filename or content | Mac OS
  5. Set up sites
    1. About Dreamweaver sites
    2. Set up a local version of your site
    3. Connect to a publishing server
    4. Set up a testing server
    5. Import and export Dreamweaver site settings
    6. Bring existing websites from a remote server to your local site root
    7. Accessibility features in Dreamweaver
    8. Advanced settings
    9. Set site preferences for transferring files
    10. Specify proxy server settings in Dreamweaver
    11. Synchronize Dreamweaver settings with Creative Cloud
    12. Using Git in Dreamweaver
  6. Manage files
    1. Create and open files
    2. Manage files and folders
    3. Getting and putting files to and from your server
    4. Check in and check out files
    5. Synchronize files
    6. Compare files for differences
    7. Cloak files and folders in your Dreamweaver site
    8. Enable Design Notes for Dreamweaver sites
    9. Preventing potential Gatekeeper exploit
  7. Layout and design
    1. Use visual aids for layout
    2. About using CSS to lay out your page
    3. Design responsive websites using Bootstrap
    4. Creating and using media queries in Dreamweaver
    5. Present content with tables
    6. Colors
    7. Responsive design using fluid grid layouts
    8. Extract in Dreamweaver
  8. CSS
    1. Understand Cascading Style Sheets
    2. Laying out pages using CSS Designer
    3. Using CSS preprocessors in Dreamweaver
    4. How to set CSS Style preferences in Dreamweaver
    5. Move CSS rules in Dreamweaver
    6. Convert inline CSS to a CSS rule in Dreamweaver
    7. Work with div tags
    8. Apply gradients to background
    9. Create and edit CSS3 transition effects in Dreamweaver
    10. Format code
  9. Page content and assets
    1. Set page properties
    2. Set CSS heading properties and CSS link properties
    3. Work with text
    4. Find and replace text, tags, and attributes
    5. DOM panel
    6. Edit in Live View
    7. Encoding documents in Dreamweaver
    8. Select and view elements in the Document window
    9. Set text properties in the Property inspector
    10. Spell check a web page
    11. Using horizontal rules in Dreamweaver
    12. Add and modify font combinations in Dreamweaver
    13. Work with assets
    14. Insert and update dates in Dreamweaver
    15. Create and manage favorite assets in Dreamweaver
    16. Insert and edit images in Dreamweaver
    17. Add media objects
    18. Adding videos in Dreamweaver
    19. Insert HTML5 video
    20. Insert SWF files
    21. Add audio effects
    22. Insert HTML5 audio in Dreamweaver
    23. Work with library items
    24. Using Arabic and Hebrew text in Dreamweaver
  10. Linking and navigation
    1. About linking and navigation
    2. Linking
    3. Image maps
    4. Troubleshoot links
  11. jQuery widgets and effects
    1. Use jQuery UI and mobile widgets in Dreamweaver
    2. Use jQuery effects in Dreamweaver
  12. Coding websites
    1. About coding in Dreamweaver
    2. Coding environment in Dreamweaver
    3. Set coding preferences
    4. Customize code coloring
    5. Write and edit code
    6. Code hinting and code completion
    7. Collapse and expand code
    8. Reuse code with snippets
    9. Lint code
    10. Optimize code
    11. Edit code in Design view
    12. Work with head content for pages
    13. Insert server-side includes in Dreamweaver
    14. Using tag libraries in Dreamweaver
    15. Importing custom tags into Dreamweaver
    16. Use JavaScript behaviors (general instructions)
    17. Apply built-in JavaScript behaviors
    18. About XML and XSLT
    19. Perform server-side XSL transformations in Dreamweaver
    20. Performing client-side XSL transformations in Dreamweaver
    21. Add character entities for XSLT in Dreamweaver
    22. Format code
  13. Cross-product workflows
    1. Installing and using extensions to Dreamweaver
    2. In-App updates in Dreamweaver
    3. Insert Microsoft Office documents in Dreamweaver (Windows only)
    4. Working with Fireworks and Dreamweaver
    5. Edit content in Dreamweaver sites using Contribute
    6. Dreamweaver-Business Catalyst integration
    7. Create personalized email campaigns
  14. Templates
    1. About Dreamweaver templates
    2. Recognizing templates and template-based documents
    3. Create a Dreamweaver template
    4. Create editable regions in templates
    5. Create repeating regions and tables in Dreamweaver
    6. Use optional regions in templates
    7. Define editable tag attributes in Dreamweaver
    8. How to create nested templates in Dreamweaver
    9. Edit, update, and delete templates
    10. Export and import xml content in Dreamweaver
    11. Apply or remove a template from an existing document
    12. Edit content in Dreamweaver templates
    13. Syntax rules for template tags in Dreamweaver
    14. Set highlighting preferences for template regions
    15. Benefits of using templates in Dreamweaver
  15. Mobile and multiscreen
    1. Create media queries
    2. Changing page orientation for mobile devices
    3. Create web apps for mobile devices using Dreamweaver
  16. Dynamic sites, pages and web forms
    1. Understand web applications
    2. Set up your computer for application development
    3. Troubleshoot database connections
    4. Removing connection scripts in Dreamweaver
    5. Design dynamic pages
    6. Dynamic content sources overview
    7. Define sources of dynamic content
    8. Add dynamic content to pages
    9. Changing dynamic content in Dreamweaver
    10. Display database records
    11. Provide and troubleshoot live data in Dreamweaver
    12. Add custom server behaviors in Dreamweaver
    13. Building forms using Dreamweaver
    14. Use forms to collect information from users
    15. Create and enable ColdFusion forms in Dreamweaver
    16. Create web forms
    17. Enhanced HTML5 support for form elements
    18. Develop a form using Dreamweaver
  17. Building applications visually
    1. Build master and detail pages in Dreamweaver
    2. Build search and results pages
    3. Build a record insert page
    4. Build an update record page in Dreamweaver
    5. Building record delete pages in Dreamweaver
    6. Use ASP commands to modify database in Dreamweaver
    7. Build a registration page
    8. Build a login page
    9. Build a page that only authorized users can access
    10. Securing folders in Coldfusion using Dreamweaver
    11. Using ColdFusion components in Dreamweaver
  18. Test, preview, and publish websites
    1. Preview pages
    2. Preview Dreamweaver web pages on multiple devices
    3. Test your Dreamweaver site
  19. Troubleshooting
    1. Fixed issues
    2. Known issues

 

 

Learn how to build a delete record page in Dreamweaver that allows users to delete records in a database.

Note:

The user interface has been simplified in Dreamweaver and later. As a result, you may not find some of the options described in this article in Dreamweaver and later. For more information, see this article.

About record delete pages

Your application can contain a set of pages that lets users delete records in a database. The pages normally consist of a search page, a results page, and a delete page. A delete page is usually a detail page working in tandem with a results page. The search and results pages let the user retrieve the record and the delete page lets the user confirm and delete the record.

After creating the search and results pages, you add links on the results page to open the delete page and then build a delete page that displays the records and a Submit button.

Search for the record to delete

When users want to delete a record, they must first find that record in the database. Accordingly, you need a search and a results page to work with the delete page. The user enters search criteria in the search page and selects the record on the results page. When the user clicks the record, the delete page opens and displays the record in an HTML form.

After creating the search and results pages, you must create links on the results page to open the delete page. You then modify the links to pass the IDs of the records the user wants to delete. The delete page uses this ID to find and display the record.

  1. On the results page, create a column in the table used to display records by clicking inside the last table column and selecting Modify > Table > Insert Rows or Columns.
  2. Select the Columns option and the After Current Column option, and click OK.

    A column is added to the table.

  3. In the newly created table column, enter the string Delete in the row containing the dynamic content placeholders. Make sure you enter the string inside the tabbed repeating region.

    You can also insert an image with a word or symbol for delete.

  4. Select the Delete string to apply a link to it.
  5. In the Property inspector, enter the delete page in the Link box. You can enter any filename.

    After clicking outside the Link box, the Delete string appears linked in the table. If you Live view, you can see that the link is applied to the same text in every table row.

  6. Select the Delete link on the results page.
  7. (ColdFusion) In the Link 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). Note the name of the URL parameter because you'll use it in the delete 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:

    confirmDelete.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, the following URL is used in the Canberra row in the dynamic table:

    confirmDelete.cfm?recordID=CBR
  8. (PHP) In the Link field in the Property inspector, add the following string at the end of the URL:
    ?recordID=<?php echo $row_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). Note the name of the URL parameter because you'll use it in the delete page later.

    The expression after the equal sign is the value of the parameter. In this case, the value is generated by a PHP expression that returns a record ID from the recordset. A different ID is generated for each row in the dynamic table. In the PHP 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:

    confirmDelete.php?recordID=<?php echo $row_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, the following URL is used in the Canberra row in the dynamic table:

    confirmDelete.php?recordID=CBR
  9. (ASP) In the Link field in the Property inspector, add the following string at the end of the URL:
    ?recordID=<%=(recordsetName.Fields.Item("fieldName").Value)%>

    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). Note the name of the URL parameter because you'll use it in the delete page later.

    The expression after the equal sign is the value of the parameter. In this case, the value is generated by an ASP expression that returns a record ID from the recordset. A different ID is generated for each row in the dynamic table. In the ASP 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:

    confirmDelete.asp?recordID=<%=(rsLocations.Fields.Item("CODE").Value)%>

    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, the following URL is used in the Canberra row in the dynamic table:

    confirmDelete.asp?recordID=CBR
  10. Save the page.
  1. On the results page, create a column in the table used to display records by clicking inside the last table column and selecting Modify > Table > Insert Rows or Columns.
  2. Select the Columns option and the After Current Column option, and click OK.

    A column is added to the table.

  3. In the newly created table column, enter the string Delete in the row containing the dynamic content placeholders. Make sure you enter the string inside the tabbed repeating region.

    You can also insert an image with a word or symbol for delete.

  4. Select the Delete string to apply a link to it.
  5. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button, and select Go to Detail Page from the pop‑up menu.
  6. In the Detail Page box, click Browse and locate the delete page.
  7. In the Pass URL Parameter box, specify the name of your parameter, such as recordID.

    You can make up any name you like, but take note of the name because you'll use it in the delete page later.

  8. Specify the value you want to pass to the delete page by selecting a recordset and a column from the Recordset and Column pop‑up menus. Typically the value is unique to the record, such as the record’s unique key ID.
  9. Select the URL Parameters option.
  10. Click OK.

    A special link surrounds the selected text. When the user clicks the link, the Go To Detail Page server behavior passes a URL parameter containing the record ID to the specified delete page. For example, if the URL parameter is called recordID and the delete page is called confirmdelete.asp, the URL looks something like the following when the user clicks on the link:

    http://www.mysite.com/confirmdelete.asp?recordID=43

    The first part of the URL, http://www.mysite.com/confirmdelete.asp, opens the delete page. The second part, ?recordID=43, is the URL parameter. It tells the delete page what record to find and display. The term recordID is the name of the URL parameter and 43 is its value. In this example, the URL parameter contains the record’s ID number, 43.

Build the delete page

After completing the page listing the records, switch to the delete page. The delete 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.

Note:

The delete page can contain only one record-editing server behavior at a time. For example, you cannot add an Insert Record or an Update Record server behavior to the delete page.

Create an HTML form to display the record

  1. Create a page and save it as the delete page you specified in the previous section.

    You specified a delete 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).

  2. Insert an HTML form on the page (Insert > Form > Form).
  3. Add a hidden form field to the form.

    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.

  4. Add a button to the form.

    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.

  5. Enhance the design of the page any way you want and save it.

Retrieve the record the user wants to delete

  1. In the Bindings panel (Window > Bindings), click the Plus (+) button and select Recordset (Query) from the pop‑up menu.

    The simple Recordset or DataSet dialog box appears. If the advanced Recordset dialog box appears instead, click Simple.

  2. Name the recordset, and select a data source and the database table that contains the records that users can delete.
  3. In the Columns area, select the table columns (record fields) you want to display on the page.

    To display only some of the record’s 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.

  4. Complete the Filter section as follows to find and display the record specified in the URL parameter passed by the results page:
    • From the first pop‑up menu in the Filter area, select the column in the recordset containing values that match the value of the URL parameter passed by the page with the Delete links. For example, if the URL parameter contains a record ID number, select the column containing record ID numbers. In the example discussed in the previous section, the recordset column called CODE contains the values that match the value of the URL parameter passed by the page with the Delete links.

    • From the pop‑up menu beside the first menu, select the equal sign, if not already selected.

    • From the third pop‑up menu, select URL Parameter. The page with the Delete links uses a URL parameter to pass information to the delete page.

    • In the fourth box, enter the name of the URL parameter passed by the page with the Delete links.

       

    Recordset dialog box
    Recordset dialog box

  5. Click OK.

    The recordset appears in the Bindings panel.

Display the record the user wants to delete

  1. Select the recordset columns (record fields) in the Bindings panel, and drag them to the delete page.

    Make sure you insert this read-only dynamic content within the form boundaries. For more information on inserting dynamic content in a page, see Make text dynamic.

    Next, you must bind the record ID column to the hidden form field.

  2. Make sure Invisible Elements are enabled (View > Visual Aids > Invisible Elements), and then click the yellow shield icon that represents the hidden form field.

    The hidden form field is selected.

  3. In the Property inspector, click the lightning bolt icon beside the Value box.
  4. In the Dynamic Data dialog box, select the record ID column in the recordset.

    In the following example, the record ID column, CODE, contains unique store codes.

    Record ID column selected
    Record ID column selected

  5. Click OK and save the page.
    Completed delete page
    Completed delete page

Add logic to delete the record

After displaying the selected record on the delete page, you must add logic to the page that deletes the record from the database when the user clicks the Confirm Deletion button. You can add this logic quickly and easily by using the Delete Record server behavior.

To add a server behavior to delete the record (ColdFusion, PHP)

  1. Make sure the ColdFusion or PHP delete page is open in Dreamweaver.
  2. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button, and select Delete Record.
  3. In the First Check If Variable Is Defined box, make sure Primary Key Value is selected.

    You specify the primary key value later in the dialog box.

  4. In the Connection or Data Source (ColdFusion) pop‑up menu, select a connection to the database so that the server behavior can connect to the affected database.
  5. In the Table pop‑up menu, select the database table that contains the records that will be deleted.
  6. In the Primary Key Column pop‑up menu, select the table column that contains record IDs.

    The Delete Record server behavior searches this column for a match. The column should contain the same record ID data as the recordset column you bound to the hidden form field on the page.

    If the record ID is numeric, select the Numeric option.

  7. (PHP) In the Primary Key Value pop‑up menu, select the variable on your page that contains the record ID identifying the record to be deleted.

    The variable is created by your hidden form field. It has the same name as the name attribute of the hidden field and is either a form or URL parameter, depending on the form’s method attribute.

  8. In the After Deleting, Go To box, or the On Success, Go To box, specify a page to open after the record has been deleted from the database table.

    You can specify a page that contains a brief success message to the user, or a page listing the remaining records so that the user can verify that the record has been deleted.

    Delete Record dialog box
    Delete Record dialog box

  9. Click OK, and save your work.

To add a server behavior to delete the record (ASP)

  1. Make sure the ASP delete page is open in Dreamweaver.
  2. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button, and select Delete Record.
  3. In the Connection pop‑up menu, select a connection to the database so that the server behavior can connect to the affected database.

    Click the Define button if you need to define a connection.

  4. In the Delete from Table pop‑up menu, select the database table that contains the records to be deleted.
  5. In the Select Record From pop-up menu, specify the recordset that contains the records to be deleted.
  6. In the Unique Key Column pop-up menu, select a key column (usually the record ID column) to identify the record in the database table.

    If the value is a number, select the Numeric option. A key column usually accepts only numeric values, but sometimes it accepts text values.

  7. In the Delete By Submitting pop-up menu, specify the HTML form with the Submit button that sends the delete command to the server.
  8. In the After Deleting, Go To box, specify a page to open after the record has been deleted from the database table.

    You can specify a page that contains a brief success message to the user, or a page listing the remaining records so that the user can verify that the record has been deleted.

  9. Click OK, and save your work.

Test your delete pages

  1. Upload the search, results, and delete pages to your web server, open a browser and search for a disposable test record to delete.

    When you click a Delete link on the results page, the delete page should appear.

  2. Click the Confirm button to delete the record from the database.
  3. Verify that the record has been deleted by searching for the record again. The record should no longer appear in the results page.

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online