Specifications
Server Behaviors 151
The Server Behavior API
You can manage server behaviors with the following API functions.
analyzeServerBehavior()
Availability
Dreamweaver UltraDev 1
Description
Lets server behaviors set their incomplete and deleted flags.
After the
findServerBehaviors() function is called for every server behavior on the page, an
array of all the behaviors in the user’s document appears. The analyzeServerBehavior()
function is called for each JavaScript object in this array. For example, for a Dynamic Text
behavior, Dreamweaver calls the
analyzeServerBehavior() function in DynamicText.htm (or
DynamicText.js).
One purpose of the
analyzeServerBehavior() function is to finish setting all the properties
(
incomplete, participants, selectedNode, and title) on the behavior object. Sometimes it’s
easier to perform this task after
findServerBehaviors() generates the complete list of server
behaviors in the user’s document.
The other purpose of the
analyzeServerBehavior() function is to notice when two or more
behaviors refer to the same tag in the user’s document. In this case, the
deleted property removes
all but one behavior from the array.
Suppose the following three server behaviors are on a page: Recordset1, DynamicText1, and
DynamicText2. Both DynamicText server behaviors need Recordset1 to exist on the page. After
the server behaviors are found with
findServerBehaviors(), Dreamweaver calls
analyzeServerBehavior() for the three server behaviors. When analyzeServerBehavior() is
called for DynamicText1, the function searches the array of all the server behavior objects on the
page, looking for the one that belongs to Recordset1. If a server behavior object that belongs to
Recordset1 cannot be found, the
incomplete property is set to true so that an exclamation point
appears in the Server Behaviors panel, which alerts the user that a problem exists. Similarly, when
analyzeServerBehavior() is called for DynamicText2, the function searches for the object that
belongs to Recordset1. Because Recordset1 does not depend on other server behaviors, it does not
need to define the
analyzeServerBehavior() function in this example.
Arguments
serverBehavior, [serverBehaviorArray]
• serverBehavior is a JavaScript object that represents the behavior to analyze.
• [serverBehaviorArray] is an array of JavaScript objects that represents all the server
behaviors that are found on a page.
Returns
Nothing.