Execute Script (Simple actions)

Executes a script or EL expression.

Defined in

Simple actions

Type

Basic (Server)

Syntax

Note: This is the XSP source code. The UI presents the simple action as a dialog with a box for each argument.
executeScript script=#{javascript:<JavaScript>}
executeScript script=#{<EL_expression>}
Arguments Description UI presentation
script One of the following:
  • javascript
  • xpath
  • null (for EL)
A combo box with the options JavaScript (Server Side), Expression Language (EL), or Custom.
JavaScript Valid JavaScript code. An area to type the script plus an Open Script Editor button.
EL_expression Valid EL expression. An area to type the expression plus an Open Script Editor button.

Usage

See Introduction to the JavaScript and XPages reference for writing JavaScript. Search the Web for documentation EL expressions.

If you specify Custom in the UI, enter XSP source code starting with # (the pound sign) and ending with } (the closing brace).

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 create a new document.
<xp:button value="Save" id="button1" style="width:148.0px">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
	<xp:executeScript><xp:this.script>
		<![CDATA[#{javascript:var doc = database.createDocument(); doc.appendItemValue("Subject", "my subject"); return doc.save()}]]>
	</xp:this.script></xp:executeScript>
</xp:this.action></xp:eventHandler></xp:button>