decorative banner

Deleting records in a database


    GoLive provides a form Action that allows you to delete records from a database. Needless to say, you must be very careful with delete actions. The standard action GoLive provides will only delete one record at a time. To perform more extensive deletions, you will need to implement a custom action using GoLive extensibility capabilities.

    The Delete action is applied on a form that is showing content from a single, specific record. The values in the form fields are not used in determining which record to delete; it is always the record from which the values came that is deleted. The content source must select one record either because of query filter settings (creating a test that selects exactly one record) or because of record navigation URL parameters (causing the more general content source to pick one specific record). The record navigation URL parameters are set as a result of arriving at the page from a link with a link action set. Link actions such as Show Details of Current Record and Show Next Record (or Last, First, Previous) will cause the content source to select a specific record.

To set up a form for a record deletion:

  1. Create the form and fields as desired for display of the record to be deleted.
  2. Add a content source to the page connected to the database from which selects the table from which a record is to be deleted.
  3. Bind the form elements (if any) to fields in the content source.
  4. Add a form Submit Button to the form and select it. It is usually a good idea to set the label to a string appropriate to its function such as "Delete".
  5. In the Dynamic Bindings palette, set the form action to Delete Record. This will be a second level menu item under "ADO Database" for ASP, "MySQL" for PHP, and "JDBC" for JSP.
  6. Set the Content source to the content source that references the table from which the record will be deleted.
  7. If the design of the interaction dictates that the next page the user sees after pressing the form submit button is the same page, you do not need to set the redirect URLs. If not, you can define the next page to be displayed after the record is deleted, and the next page to be displayed if there is an error deleting the record. If you go back to the same page, you won't be able to still display the deleted record. The content source will automatically reposition to a nearby record if possible.
  8. You can have more than one submit button on the form, each with a different action. For example, the form can have a button to update the current record, to delete it, and to copy it.

    Make sure you have set up proper database permissions for the Web server to make deletions or for the identity specified in data source to make deletions. Remember that when your action is being processed on the server, the Web server's identity is used to validate file access. The Web server's identity is also used to validate database access unless there is another identity specified as part of the data source.

    Database restrictions on deletion will apply. For example, in most cases, you cannot delete records through a view.