Adobe
GoLive 6 Dynamic Content Samples
Overview
Database Design
Front Page
Story
List Stories
Publish Stories
Edit Story

A. Record number and count. B. Link for creating a new story. C. Navigation links for moving between stories. D. Text fields for editing title and author. E. Dynamically constructed pulldown menu for changing editor. F. Dynamically constructed radio buttons for setting workflow status. G. Text areas for editing summary and main story text. H. Text field and image for setting image. I. Form submission buttons.

Content Sources

Edit Story has three content sources: the Stories, Editors, and Statuses tables from the Stories database.

The main content source is the Stories table. When the user arrives at this page by clicking on a story link, the URL includes the ID of the story that the user has clicked. In this case the content source automatically selects the appropriate story. If the user arrives at this page by clicking on the Edit link in the Administration View table of contents, the content source selects the first story in the database.

The remaining two content sources, Editors and Statuses, are used to dynamically construct the pulldown menu and radio buttons.

Tab

The Main View tab uses Show Details of Current Record so that when a user clicks it, he can see how the current story looks in the main view.

A.

The record number and count indicate which story is being displayed and how many stories are in the database. These special bindings are available at the bottom of the field list when you bind an element.

B.

The link to create a new story uses Show Details of Empty Record. When the user clicks on this link, the form displays a new record so that the user can add a story to the database. Nothing is really added until the user enters his story and clicks the update button, so it is easy to cancel the action.

C.

Clicking one of the navigation links redisplays the edit page with a different story. These links are created using the navigation Link Actions in the Dynamic Bindings palette. GoLive automatically sets the link href to be the current page.

D.

The text inputs for title and author are bound in the same way as ordinary text.

E.

The pulldown menu and radio buttons are dynamically constructed based on information in the database. In the editors pulldown menu, the list of choices is found by looking at the Editors content source. There is one choice in the pulldown menu for each record in the content source.

To dynamically construct a pulldown menu you use the Construct Dynamically section of the Dynamic Bindings palette. There are three different text boxes: one to specify where to get the list of options, one to specify the field in that list that has the labels a user sees, and one to specify the field that has the values to record when a user selects an option. In this example the labels and values both use the Editors.Name field. In another application the database might provide different fields for the labels and values.

Whether a pulldown menu is static or dynamic, you bind it just like you bind any other form control. This one is bound to the editor of the current story.

F.

A group of radio buttons works like a pulldown menu, in that it allows a user to pick one choice from among several. If you know the values that the user can pick ahead of time, then creating and binding the individual buttons is easy. You simply put in the appropriate number of radio buttons, use the Inspector palette to assign each one a value from the list of choices, and then bind each radio button to the field you want to edit. When the page runs, the radio button that corresponds to the current value is selected.

In this case the list of values should be pulled out of the Statuses table, so we need to do something more complicated. Here's how it works:

  1. The dynamic table displays one row for each status listed in the Statuses table.
  2. The label in each row is bound to the label of the current status.
  3. The radio button in each row is bound to the workflow status of the overall story.
  4. The value of each radio button is dynamically constructed from the label of the current status. As with a pulldown menu, in another application the values and labels might come from different database fields.

The overall effect is to create an array of radio buttons, one per workflow status.

G.

The text areas for summary and story text are bound the same way as ordinary text. Since a story can include arbitrary punctuation and HTML markup, both of these controls use the Encode String as HTML filter. This filter makes sure that special characters like '<' are handled correctly, so that the page does not contain unexpected syntax errors when the dynamic content is added. It is a good idea to use this filter with all text area controls.

H.

The text input and image are both bound to the Stories.Image field. The text input shows the URL as a text string; the image shows it as an image.

I.

The two form buttons have Form Actions selected from the Dynamic Bindings palette. GoLive automatically targets the correct page in the config/actions folder to perform the indicated actions, in this case either updating a story or deleting it.