Scripting Parameter Values

You can customize an action’s parameter values instead of choosing from the ones NetObjects Fusion provides by generating them with a JavaScript expression. For example, you might use the value a site visitor types in a form object as the number-of-seconds value in a Delay action.

If you know JavaScript, you can enter expressions directly. You can also modify code for the default values NetObjects Fusion creates, and you can assemble expressions out of an object’s other actions. For example, an expression might test for a particular condition—like time of day—and then trigger actions you created with the Set Actions dialog based on that condition. Just as the Values dialog often lists several values, an expression can generate one or more values, too.

For an example even nonprogrammers can try, see Customizing Default Actions.

  1. In Page view, select the object whose parameter values you want to script, and add any actions you want to use as components of the JavaScript expression.

For these actions, ignore the When field, since each action is triggered by the expression. Also, if an action’s only purpose is to be called by the expression, disable the action by clearing the check box next to it on the Actions tab of the Properties palette.

  1. Create the action whose parameter value you want generated by the expression, as described in Adding Actions to Objects and Pages. Or, open an existing action by double-clicking it on the Actions tab of the Properties palette.

  2. In the Set Action dialog, open the Parameters menu and choose Expression.

The JavaScript Expression dialog appears. If the action already has default parameter values, the dialog displays the code for those values.

  1. Enter your own JavaScript to generate the parameter value, or modify the code that’s already there. NetObjects Fusion doesn't verify code you enter, so be sure to use valid syntax.

To build your expression around existing actions, click the Insert Action button, select an action from the Actions dialog, and click OK. NetObjects Fusion inserts the action at the insertion point, in the form $(ActionName).

  1. Click OK in the JavaScript Expression dialog and again in the Set Action dialog.

When the action is triggered, it uses the parameter values generated by your expression.