Adobe
GoLive 6 Dynamic Content Samples
Overview
Database Design
Topics
Messages
Create Topic
Manage Topics
Manage Messages
Delete Topic
Delete Message

text

A. Topic name and message count. B. Hidden element to submit topic name. C. Delete and cancel buttons.

Content Sources

The Delete Topic page uses the Topics query. When the user arrives at this page by clicking on a delete link, the content source automatically selects the topic he has clicked.

A

The topic name and message count display information about the topic the user is about to delete.

B

The form that contains the delete button includes a hidden element bound to the topic name. When the user clicks the delete button, the form action looks at the value of this hidden element to know which topic to delete.

C

The delete action is implemented as custom code; there is no built in Form Action to delete more than one record. The custom code is in user_forum/actions/delete_topic.asp.

The form action must delete all the messages that match the topic name bound to the hidden element. When you bind a hidden element or other form control, GoLive assigns it a name of the form 'Field[n]', where n is the current record number. This syntax allows GoLive's Form Actions to process more than one record at a time. Unfortunately, it also makes it a little tricky to extract the form values when there is only a single record. The RequestValue() function on the action page solves this problem using a regular expression search pattern.

Once the form action knows the topic to delete, it deletes all of the messages with that topic using a SQL DELETE query:

delete from Messages where Topic='...'

The cancel button on the page is not a submit button. Instead, it is a normal button that uses client side javascript to implement the cancel behavior. Here is what the javascript looks like:

onclick="document.URL='topics_admin.asp'

When the user clicks this button, he returns to the Manage Topics page without making any changes to the database.