Thursday, May 20, 2010

Creating Simple Dialog Box In XPage

The following is a procedure that will help you to create a simple Dojo Dialog Box in XPage

1. Create an XPage
2. Create a Panel and put some text inside it
3. In the All properties tab of the XPage, Mark the parameters, dojoTheme and dojoParseOnLoad as true (refer to the following figure)

4.Move to the source code panel and add the following code snippet

        <xp:dojoModule name="dijit.Dialog"></xp:dojoModule>

5. Now add a button and in the onclick event of the button (client side)
put the following client side javascript


Now preview your XPage on the client or on the browser and click the button.
You will be able to see a nice dojo popup

The source code of the Xpage that I developed for this particular task is as follows,

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="" dojoParseOnLoad="true"

        <xp:dojoModule name="dijit.Dialog"></xp:dojoModule>
    <xp:button value="Dialog Popup" id="button2">
        <xp:eventHandler event="onclick" submit="false">
    <div id="myDialogContainer" dojoType="dijit.Dialog"
        <xp:panel>Test Popup</xp:panel>

Pain Point: Using this method one can probably use these pop ups in places that does not require any server side operations. 'cos server side script does not work with any elements inside this popup.

To work with server side scripts in dojo popups in XPages refer to the following post:
Dojo Popup in Xpages - Working with Serverside Scripts - A simple illustration

Hope this helps :)


  1. Thanks for your Simple Dialog Box In XPage

  2. In case your readers want plain dialog box with xpage, they can see my dojo dialog box tutorial

  3. Nice one. Thanks for sharing Sandeep

  4. hey, thanks for sharing this Xpage code for dojo dialog box. Nice way to get around the static nature of dojo dialogs

  5. hi ,

    how to close the dialog opened on click of button in x pages. Please help

  6. New to xpages..simply copied the source code in to an xpage and did a Design preview in Webbrowser as well as Notes, but getting an exception error? any ideas?