Setting the Server Behavior Builder dialog box options

Setting the Server Behavior Builder dialog box options

To complete the Server Behavior builder dialog box:

This is a picture of the feature being described.

  1. Start a code block by clicking the Plus (+) button, entering a name for the code block, and clicking OK.

    One convention is to name code blocks as follows:

    NameOfBehavior_NameOfBlock
    

    Here is an example:

    MoveToRecord_Init
    
  2. In the Code Block text area, enter the runtime code to be inserted in the page.

    The runtime code must be a single tag block or script block. If you need to insert multiple tags or script blocks, split them into separate code blocks. You can also copy and paste code from other pages.

    For more information, see the following sections:

    • Using parameters in server behaviors
    • Positioning code blocks
    • Repeating code blocks
    • Coding guidelines
  3. Specify where to insert the code block in the page’s HTML source code by using the Insert Code pop-up menu.

    Code blocks are inserted relative to tags in the page or relative to a tag selected by the page designer. For more information, see Positioning code blocks.

  4. To specify more advanced settings, click Advanced.

    Once you specify the source code and insert location for each code block, the server behavior is completely defined. In most cases, you don’t need to specify any additional information.

    If you are an advanced user, you may want to modify additional parameters by clicking the Advanced button in the Server Behavior Builder. The builder expands to display several new options.

    This is a picture of the feature being described.

    Identifier specifies whether or not the code block should be treated as an identifier.

    By default, every code block is an identifier. If Dreamweaver finds an identifier code block anywhere in a document, it lists the behavior in the Server Behaviors panel. Use the Identifier checkbox to specify whether the code block should be treated as an identifier.

    At least one of the server behavior’s code blocks must be an identifier. A code block should not be an identifier if one of the following conditions applies: the same code block is used by some other server behavior; or the code block is so simple that it might occur naturally on the page.

    Server Behavior Title specifies the title of the behavior in the Server Behaviors panel.

    When the page designer clicks the Plus (+) button on the Server Behaviors panel, the new server behavior’s title will appear in the pop-up menu. When a designer applies an instance of a server behavior to a document, the behavior appears in the list of applied behaviors in the Server Behaviors panel. Use the Server Behavior Title text box to specify the contents of the Plus (+) pop-up menu and the list of applied behaviors.

    The initial value in the box is the name you supplied in the New Server Behavior dialog box. As parameters are defined, the name is automatically updated so that the parameters appear inside parentheses after the server behavior name.

    Set Session Variable (@@Name@@, @@Value@@) 
    

    If the user accepts the default value, everything before the parentheses will appear in the Plus (+) pop-up menu (for example, Set Session Variable). The name plus the parameters will appear in the list of applied behaviors--for example, Set Session Variable ("abcd", "5").

    Code Block to Select specifies what code block is selected when the user selects the behavior in the Server Behaviors panel.

    When you apply a server behavior, one of the code blocks within the behavior is designated the "code block to select." If you apply the server behavior and then select the behavior in the Server Behaviors panel, in the Document window Dreamweaver automatically selects the designated block. By default, Dreamweaver selects the first code block that is not above the html tag. If all the code blocks are above the html tag, then Dreamweaver selects the first one. Advanced users can specify which code block is the selected one.

  5. Repeat steps 1 to 4 for each code block in your server behavior.
  6. If you have two or more code blocks with the same insert location, you can change their positions relative to each other by clicking the up and down arrows.
  7. Do one of the following:
    • If you did not define any designer-supplied parameters in your code, click OK.

      Dreamweaver creates the server behavior with no dialog box. The new server behavior appears in the Plus (+) menu of the Server Behaviors panel.

    • If you defined designer-supplied parameters in your code, Dreamweaver prompts you to configure a dialog box for the server behavior before creating it.

      For more information, see Creating a dialog box for a custom server behavior.

Related topics

  • Server behaviors
  • Using the Server Behavior Builder
  • Using parameters in server behaviors
  • Using parameters in server behaviors
  • Positioning code blocks
  • Repeating code blocks
  • Coding guidelines
  • Positioning code blocks
  • Creating a dialog box for a custom server behavior


Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Defining Sources of Dynamic Content
Developing Applications Rapidly