button - Button
Displays a button that the user can click to perform an action.
Category
Core ControlsSyntax
<xp:button attributes>content</xp:button>
Property | Description |
---|---|
id | Defaults to button1 , button2 ,
and so on. |
value | Specifies the label for the button. |
eventHandler | Specifies the action when the button is activated. See the usage section. |
Category | Properties |
---|---|
accessibility | accesskey, iconAlt, role, tabindex, title |
basics | attrs, binding, dir, disabled, disableValidators, execId, execMode, icon, id, lang, loaded, navigate, refreshId, refreshMode, rendered, rendererType, save, type, value |
dojo | dojoAttributes, dojoType |
events | action, actionListener, actionListeners, immediate,onblur, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup |
styling | disableTheme, outerStyleClass, style, styleClass, themeId |
Usage
At run time, a button appears on the page. The user can click the button.Buttons are of three types:
- Button (default) responds to event handlers
that you create, for example, for
onclick
. For accessibility compliance, thevalue
property must describe the action being performed. - Submit saves data and closes the page.
For accessibility compliance, the
value
property must beSubmit
. - Cancel closes the page. For accessibility
compliance, the
value
property must beCancel
.
navigationRules
property for the page which is Next
page (success or cancel) in the UI.To set the button
type in the UI, click Button under Properties and
look for Button type. The generated
eventHandler
property
has the following attributes. Follow these rules if you construct
the eventHandler
property manually.Button | Submit | Cancel |
---|---|---|
event=any |
event="onclick" |
event="onclick" |
submit=any |
submit="true" |
submit="true" |
refreshMode=any |
refreshMode="complete" |
refreshMode="complete" |
immediate=any |
immediate="false" |
immediate="true" |
save=any |
save="true" |
save="false" |
action=simple action or event handler |
action=none |
action=none |
Examples
This Button control is of type Submit.<xp:button id="button1" value="Submit">
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete" immediate="false" save="true">
</xp:eventHandler>
</xp:button>
This Button control is of type Cancel.
<xp:button id="button2" value="Cancel">
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete" immediate="true" save="false">
</xp:eventHandler>
</xp:button>
This Button control is of type Button
and executes the Save Data simple action when clicked.
<xp:button id="button1" value="Save and Exit">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:save name="/xpage2.xsp"></xp:save>
</xp:this.action>
</xp:eventHandler>
</xp:button>