These functions can be added or edited within the HTML script files or the specified JavaScript files that are listed within the HTML script file.

dwscripts.findSBs()

Availability

Dreamweaver MX (this function replaces the findSBs() function from earlier versions of Dreamweaver).

Description

Finds all instances of a server behavior and all the participants on the current page. It sets the title, type, participants array, weights array, types array, selectedNode value, and incomplete flag. This function also creates a parameter object that holds an array of user-definable properties such as recordset, name, and column name. You can return this array from the findServerBehaviors() function.

Arguments

serverBehaviorTitle

The serverBehaviorTitle argument is an optional title string that is used if no title is specified in the EDML title, which is useful for localization.

Returns

Dreamweaver expects an array of JavaScript objects where the required properties are defined. Returns an empty array if no instances of the server behavior appear on the page.

Example

The following example searches for all instances of a particular server behavior in the current user document:

 function findServerBehaviors() { 
    allMySBs = dwscripts.findSBs(); 
    return allMySBs; 
}

dwscripts.applySB()

Availability

Dreamweaver MX (this function replaces the applySB() function from earlier versions of Dreamweaver).

Description

Inserts or updates runtime code for the server behavior. If the sbObj argument has a null value, it inserts new runtime code; otherwise, it updates existing runtime code that is indicated by the sbObj object. User settings should be set as properties on a JavaScript object and passed in as paramObj. These settings should match all the arguments that are declared as @@paramName@@ in the EDML insertion text.

Arguments

paramObj, sbObj

  • The paramObj argument is the object that contains the user settings.

  • The sbObj argument is the prior server behavior object if you are updating an existing server behavior; null otherwise.

Returns

Dreamweaver expects a Boolean value: true if the server behavior is added successfully to the user’s document; false otherwise.

Example

In the following example, you fill the paramObj object with the user’s input and call the dwscripts.applySB() function, passing in the input and your server behavior, sbObj:

 function applyServerBehaviors(sbObj) { 
    // get all UI values here... 
    paramObj = new Object(); 
    paramObj.rs        = rsName.value; 
    paramObj.col     = colName.value; 
    paramObj.url     = urlPath.value; 
    paramObj.form__tag = formObj; 
     dwscripts.applySB(paramObj, sbObj); 
}

dwscripts.deleteSB()

Availability

Dreamweaver MX (this function replaces the deleteSB() function from earlier versions of Dreamweaver).

Description

Deletes all the participants of the sbObj server behavior instance. The entire participant is deleted, unless the EDML file indicates special delete instructions with the delete tag. It does not delete participants that belong to more than one server behavior instance (reference count > 1).

Arguments

sbObj

  • The sbObj argument is the server behavior object instance that you want to remove from the user’s document.

Returns

Dreamweaver expects nothing.

Example

The following example deletes all the participants of the sbObj server behavior, except the participants that are protected by the EDML file’s delete tag.

 function deleteServerBehavior(sbObj) { 
    dwscripts.deleteSB(sbObj); 
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy