Execute Client Script (Simple actions)

Executes a client-side script.

Defined in

Simple actions

Type

Basic (Client)

Syntax

Note: This is the XSP source code. The UI presents the simple action as a dialog with a box for each argument.
executeClientScript ![CDATA[JavaScript]]
Arguments Description UI presentation
Not shown in XSP. The following:
  • javascript
A combo box with the option JavaScript (Client Side).
JavaScript Valid JavaScript code. An area to type the script plus an Open Script Editor button.

Usage

See Introduction to the JavaScript and XPages reference for writing JavaScript.

Examples

Note: These examples present XSP source code which can be inserted under the Source tab taking care to keep the XML well formed. To use the UI, select or enter the arguments in the simple action dialog.
This button uses JavaScript to post an alert.
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete" id="eventHandler1">
<xp:this.script>
	<xp:executeClientScript>
		<xp:this.script><![CDATA[window.alert("Hello world!")]]></xp:this.script>
	</xp:executeClientScript>
</xp:this.script>
</xp:eventHandler></xp:button>