Client JavaScript Builder

 

 

In this topic ...

Quick Tips

Specifying Inputs

 

Related Topics ...

Javascript Guidelines

Use the Client JavaScript builder to add client-side JavaScript to a specified page in a model .

The builder places a pair of <SCRIPT> tags in the model. The information you enter or reference in the JavaScript field is placed between these tags. For example, if you enter alert("Hello World"); in the JavaScript field. The following code is created by the builder to display a Windows alert box:

<script name="AlertWindow" language="JavaScript"> alert("Hello World") </script>

AlertWindow is the span tag assigned to the Client JavaScript builder.

 

Quick Tips

  • We can only use client-side JavaScript with this builder.

  • In the JavaScript field we can create functions and make calls to other client-side JavaScript functions that are loaded when the page is rendered.

 

Specifying Inputs

The Client JavaScript builder takes the inputs described in the table below. For help on inputs common to many or all builders such as those in the Properties and HTML Attributes input groups, see Using the Builder Call Editor.

Input Name Description
Name Enter a name for this builder call. The Designer displays this name in the Builder Call List.
Page Location Use the Page Location input to specify the page or pages on which this builder call will act. Alternatively, we can type in the page location syntax directly. For example,

Page pageName NameSearch spanName.

See Locating Control Builders on Pages for detailed documentation about the Page Location input and page location syntax.

JavaScript Enter JavaScript you want to use when the model is run or enter an indirect reference to a variable containing the JavaScript (for example, ${Variables/variablename}. You do not need to surround the JavaScript with <SCRIPT> tags because the Script builder adds them at run time.

In this field, we can provide JavaScript that writes text...

document.writeln("<b> Hello!</b>");

In the example above, Hello! is written in bold text to the page. The following is the code created by the builder at run time:

<script name="HelloText" language="JavaScript"> document.writeln("<b> Hello!</b>"); </script>

where HelloText is the span tag assigned to the Client JavaScript builder

Enter only client-side JavaScript in the JavaScript field.