DREAMWEAVER CS3
User Guide
600
var MM_ERROR_STRING = "...";
function MM_hideLayer() {
Avoid similar code blocks
so that the code you write doesn’t resemble too closely the code in other blocks. If a code
block looks too much like another code block on the page, the Server Behaviors panel might mistakenly identify the
first code block as an instance of the second code block (or conversely). A simple solution is to add a comment to a
code block to make it more unique.
See also
“About custom server behaviors” on page 589
“Custom server behaviors workflow” on page 590
Testing server behaviors
The Dreamweaver Exchange recommends performing the following tests on each server behavior you create:
•
Apply the behavior from the Server Behaviors panel. If it has a dialog box, enter valid data in each field and click
OK. Verify that no error occurs when the behavior is applied. Verify that the run-time code for the server behavior
appears in the Code inspector.
•
Apply the server behavior again and enter invalid data in each field of the dialog box. Try leaving the field blank,
using large or negative numbers, using invalid characters (such as /, ?, :, *, and so on), and using letters in numeric
fields. You can write form validation routines to handle invalid data (validation routines involve hand-coding,
which is beyond the scope of this book).
After successfully applying your server behavior to the page, verify the following:
•
Check the Server Behaviors panel to make sure the name of the server behavior appears in the list of behaviors
added to the page.
•
If applicable, verify that server-side script icons show up on the page. The generic server-side script icons are gold
shields. To see the icons, enable Invisible Elements (View > Visual Aids > Invisible Elements).
•
In Code view (View > Code), verify that no invalid code is generated.
In addition, if your server behavior inserts code in the document establishing a connection to a database, create a
test database to test the code inserted in the document. Verify the connection by defining queries that produce
different sets of data, and different sizes of data sets.
Finally, upload the page to the server and open it in a browser. View the page’s HTML source code and verify that no
invalid HTML has been generated by the server-side scripts.
Creating forms
About forms
You can use Dreamweaver to create forms with text fields, password fields, radio buttons, check boxes, pop-up
menus, clickable buttons, and other form objects. Dreamweaver can also write code that validates the information a
visitor provides. For example, you can check that an e-mail address that a user enters contains an “@” symbol, or that
a required text field contains a value.
For more information on ColdFusion and ASP.NET forms, see “Building ColdFusion MX 7 forms” on page 674 and
“Building ASP.NET forms” on page 686.
September 4, 2007