eventHandler - Event Handler (control)

Responds to user actions such as clicking a control.

Category

Other Controls

Syntax

<xp:eventHandler attributes>content</xp:eventHandler>
Table 1. Essential properties
Property Description
save Saves form-associated data or not. This should be false for buttons of type Cancel.
submit This is true to send a request to and get a response from the server. A client handler can cancel sending a request by returning false.
refreshMode Specifies whether the page refresh is complete, partial, or not performed.
immediate This should be true for buttons of type Cancel.

Usage

See Understanding events.

Examples

This is a Button control of type Submit.
<xp:button value="submit" id="button1">
	<xp:eventHandler event="onclick" submit="true"
		refreshMode="complete" immediate="false" save="true">
	</xp:eventHandler>
</xp:button>
This is a Button control of type Cancel.
<xp:button value="cancel" id="button2">
	<xp:eventHandler event="onclick" submit="true"
		refreshMode="complete" immediate="true" save="false">
	</xp:eventHandler>
</xp:button>
This is a Button control with a user-coded onclick event.
<xp:button value="set username" id="button3">
	<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
		<xp:this.action>
			<![CDATA[#{javascript:getComponent("inputText2").setValue(session.getCommonUserName())}]]>
		</xp:this.action>
	</xp:eventHandler>
</xp:button>