The Server Behavior Builder lets you add the code block or blocks that the behavior inserts into a page.
- In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button and select New Server Behavior from the pop-up menu.
The New Server Behavior dialog box appears.
- From the Document Type pop-up menu, select the document type that you are developing the server behavior for.
- In the Name text box, enter a name for the server behavior.
- If you want to copy an existing server behavior to add to the behavior you are creating, select the Copy Existing Server Behavior checkbox.
When this checkbox is selected, a list of available server behaviors is displayed in the Behavior to Copy pop-up menu.
- Click OK.
The Server Behavior Builder dialog box is displayed.
- To add a new code block, click the Plus (+) button.
The Create a New Code Block dialog box is displayed.
- Enter a name for the code block you want to create and click OK.
The name you entered in the dialog box appears in the Server Behavior Builder, with the appropriate scripting tags visible in the Code block text box.
- In the Code Block text box, enter the code necessary to implement the server behavior.
When entering code in the Code Block text box:
- You can insert only a single tag or code block for each named code block (for example,
myBehavior_blockn, etc.). If you need to enter multiple tags or code blocks, you must create an individual code block for each using the Server Behavior Builder.
- To include runtime parameters in a code block:
- Place the insertion point in the code block where youd like to insert the parameter.
- Click the Insert Parameters in Code Block button.
The Insert Parameters in Code Block dialog box appears.
- Enter a name for the parameter in the Parameter Name text box.
- Click OK.
The parameter name is inserted in the code block.
- Repeat steps 6 through 8 for each new code block you want to create.
- In the Parameter Name pop-up menu, enter a name for the parameters, and click OK.
The parameter is inserted into the code block at the location where you placed the insertion point prior to defining the parameter.
- Select an option from the Insert Code pop-up menu specifying the location in which to embed the code blocks.
For more information see Positioning code blocks.
- You can specify additional information about the server you are creating by using the Advanced options panel.
- Click the Advanced button to display more options.
- If you need to create more code blocks, repeat steps 7 through 13 as needed.
- If the server behavior requires that parameters be supplied to it, you will need to create a dialog box that accepts parameters from the person applying the behavior.
To create a dialog box that accepts user input parameters, see Creating a dialog box for a custom server behavior.
- After you have performed the above steps as required by the server behavior you are creating, Click OK.
Once you create a server behavior, it is listed in the Server Behaviors panel. Test the server behavior and ensure that it functions properly.