Dreamweaver CS4 Resources
|
Complete the update page block by block
An update page has three building blocks:
Add an HTML form to an update page- Create a page (File > New >
Blank Page). This becomes your update page.
- Lay out your page using the Dreamweaver design
tools.
- 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.
- Name the HTML form by clicking the <form> 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.
- 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.
- 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- Make sure you defined a recordset to
hold the record the user wants to update.
See Retrieve the record to update.
- Bind each form object to data in the recordset, as described
in the following topics:
Add a server behavior to update the database table- 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.
- Select a form from the Submit Values From pop‑up menu.
- In the Data Source or Connection pop‑up menu, select
a connection to the database.
- Enter your user name and password if applicable.
- In the Update Table pop‑up menu, select the database
table that contains the record you are updating.
- (ColdFusion, PHP) Specify a database column to update,
select the form object that will update the column from the Value
pop‑up menu, select a data type for the form object from the Submit
As pop‑up menu, and select Primary Key if you want to identify this
column as the primary key.
The data type is the kind of data the column in your database
table is expecting (text, numeric, Boolean option values).
Repeat
the procedure for each form object in your form.
- (ASP) In the Select Record From pop‑up menu, specify
the recordset that contains the record displayed in the HTML form.
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.
Select the Numeric option if the value is a number. A key column
usually accepts only numeric values, but sometimes accepts text
values.
- In the After Updating or On Success, Go To box, enter
the page to open after the record updates in the table or click
the Browse button to browse to the file.
- (ASP) Specify a database column to update, select the
form object that will update the column from the Value pop‑up menu,
and then select a data type for the form object from the Submit
As pop‑up menu. The data type is the kind of data the column in
your database table is expecting (text, numeric, Boolean option
values). Repeat the procedure for each form in your form.
- Click OK.
Dreamweaver adds a server behavior
to the page that lets users update records in a database table by
modifying the information displayed in the HTML form and clicking
the Submit button.
To edit the server behavior, open the Server
Behaviors panel (Window > Server Behaviors) and double-click
the Update Record behavior.
|