onclick - Click Script
Activates an event handler when a mouse click occurs.
Category
eventsSyntax
<xp:eventHandler event="onclick" attributes>content</xp:eventHandler>
Usage
For detailed event handler syntax, see eventHandler - Event Handler (property).Examples
This button has both client and server handlers for theonclick
event. The client handler
runs first. If the confirm
statement returns true
(the user responds OK
), the server handler runs.<xp:button value="Click" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<![CDATA[#{javascript:requestScope.status = "Button clicked"}]]>
</xp:this.action>
<xp:this.script>
<![CDATA[return confirm("Do you want to submit?")]]>
</xp:this.script>
</xp:eventHandler>
</xp:button>