Buttons for a form in a Custom Control

There are standard buttons that are often added to a form that perform the basic functions (edit, save, close) that usually you put in a form.
The code in this post is a Custom Control that you can add to a XPage connected to a lotus form to place the buttons Edit, Save and Close.
In the XPage under the label “Data” configure “Data sources” to the form lotus and under the label “XPage” set the “Next Page” as follows:

Create and add a Custom Control to the XPage with the following code:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

	<xp:button value="Edit" id="btnEdit"
		<xp:eventHandler event="onclick" submit="true"
				<xp:changeDocumentMode mode="edit" />
	<xp:button value="Save" id="btnSave"
		<xp:eventHandler event="onclick" submit="true"
			refreshMode="complete" immediate="false" save="true">
					<xp:saveDocument />
	<xp:button id="btnClose" value="Close">
		<xp:eventHandler event="onclick" submit="true"
			refreshMode="complete" immediate="true" save="false"></xp:eventHandler>


The code rendered=”#{javascript:!currentDocument.isEditable()}” hides the buttons Edit and Save if the document isn’t in edit mode.
The code refreshMode=”complete” refreshes the full page.
The code immediate=”true” if the page is refreshed or a new page is open, the page stops to process (for example the fields are not validated and the latest input entered by the user is lost), used in cancel buttons.
The code immediate=”false” even if the page is refreshed or a new page is open, the page lifecycle continues, used in submit buttons.

As you can see the buttons in the client designer:


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.