Specifications

Server Behaviors 149
How the Server Behavior API functions are called
The Server Behavior API functions are called in the following scenarios:
The findServerBehaviors() function is called when the document opens and again when
the participant is edited. It searches the users document for instances of the server behavior.
For each instance it finds,
findServerBehaviors() creates a JavaScript object, and uses
JavaScript properties to attach state information to the object.
If it is implemented, Dreamweaver calls the analyzeServerBehavior() function for each
behavior instance that is found in the users document after all the
findServerBehaviors()
functions are called.
When the
findServerBehaviors() function creates a behavior object, it usually sets the four
properties (
incomplete, participants, selectedNode, and title). However, it is
sometimes easier to delay setting some of the properties until all the other server behaviors find
instances of themselves. For example, the Move To Next Record behavior has two
participants, a link object and a recordset object. Rather than finding the recordset object in its
findServerBehaviors() function, wait until the recordset behaviors
findServerBehaviors() function runs because the recordset finds all instances of itself.
When the Move To Next Record behaviors
analyzeServerBehavior() function is called, it
gets an array that contains all the server behavior objects in the document. The function can
look through the array for its recordset object.
Sometimes during analysis, a single tag in the users document is identified by two or more
behaviors as being an instance of that behavior. For example, the
findServerBehaviors()
function for the Dynamic Attribute behavior might detect an instance of the Dynamic
Attribute behavior that is associated with an
<input> tag in the users document. At the same
time, the
findServerBehaviors() function for the Dynamic Textfield behavior might look
at the same
<input> tag and detect an instance of the Dynamic Textfield behavior.
As a result, the Server Behaviors panel shows the Dynamic Attribute block and the Dynamic
Text fi e ld. To co rre ct t his p ro ble m , th e
analyzeServerBehavior() functions need to delete
all but one of these redundant server behaviors.
To delete a server behavior, an
analyzeServerBehavior() function can set the "deleted"
property of any server behavior to be
true. If the deleted property is still true when
Dreamweaver finishes calling the
analyzeServerBehavior() functions, the behavior is
deleted from the list.