beautypg.com

Display the record in the form, Add a server behavior to update the database table – Adobe Dreamweaver CC 2015 User Manual

Page 659

background image

652

Building applications visually

Last updated 6/3/2015

• An Update Record server behavior to update the database table

You can add the final two basic building blocks of an update page separately using the form tools and the Server
Behaviors panel.

Add an HTML form to an update page

1

Create a page (File > New > Blank Page). This becomes your update page.

2

Lay out your page using the Dreamweaver design tools.

3

Add an HTML form by placing the insertion point where you want the form to appear and selecting Insert > Form
> Form.

An empty form is created on the page. You may have to enable Invisible Elements (View > Visual Aids > Invisible
Elements) to see the form’s boundaries, which are represented by thin red lines.

4

Name the HTML form by clicking the

tag at the bottom of the Document window to select the form,
opening the Property inspector (Window > Properties), and entering a name in the Form Name box.

You don’t have to specify an action or method attribute for the form to tell it where and how to send the record data
when the user clicks the Submit button. The Update Record server behavior sets these attributes for you.

5

Add a form object such as a text field (Insert > Form > Text Field) for each column you want to update in the
database table.

The form objects are for data entry. Text fields are common for this purpose, but you can also use menus, options,
and radio buttons.

Each form object should have a corresponding column in the recordset you defined earlier. The only exception is
the unique key column, which should have no corresponding form object.

6

Add a Submit button to the form (Insert > Form > Button).

You can change the label of the Submit button by selecting the button, opening the Property inspector (Window >
Properties), and entering a new value in the Label box.

Display the record in the form

1

Make sure you defined a recordset to hold the record the user wants to update.

See

Retrieve the record to update

.

2

Bind each form object to data in the recordset, as described in the following topics:

Display dynamic content in HTML text fields

Dynamically preselect an HTML check box

Dynamically preselect an HTML radio button

Insert or change a dynamic HTML form menu

Make existing HTML form menus dynamic

Add a server behavior to update the database table

1

In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button and select Update Record from
the pop-up menu.

The Update Record dialog box appears.

2

Select a form from the Submit Values From pop-up menu.