In my introduction to XPages in Domino 8.5, I included a basic downloadable example that displays data from a simple view. In a real application, you would also want to examine individual documents behind a view and possibly modify selected documents. This tip gives you the tools to do this.
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
To examine the new XPages sample, download it from my website and read my previous article for background information on how to install and run any database that contains XPages.
The value of this example is in seeing how this particular code works, while also serving as a test bed for your own experimentation. Install and run this example as is to make sure that it works. Then, you can modify or extend it for your own applications.
To begin, open the new database with Domino Designer and go to the XPages category. You will see two XPages: LaunchPage and Form1Page.
- LaunchPage is a view-like page that will be displayed when the database is opened with a Web browser.
- Form1Page is an XPage that acts like a Notes form and shows all fields in a single document.
Double-click on LaunchPage to open it. Within LaunchPage, you'll see some plain text and an embedded view control. Next, follow these steps:
- Click in the upper-left of the view control to select the entire control.
- In the lower portion of the screen, select the Properties tab, then the Data sub-tab.
This panel controls what data appears in the view control. Note that it references a view in the database named View1.
- Click on the left-hand column of the view control and look at the Properties/View column. This column displays the plain text value of the data and presents a link to edit the underlying document.
Save and close LaunchPage. Be sure to save it under an ID that matches the following security setting:
Go to the server's names.nsf -> Configuration -> Servers -> All Server Documents -> <your-server> -> Security -> Sign agents or XPages to run on behalf of the invoker. Add the name of the person who last saved the XPage. In this example, that will be you.
Double-click on Form1Page and you will see several labels and fields that are similar to those in a standard Notes form. Next, follow these steps:
- Click outside of the table to select the entire page.
In the lower portion of the screen, select the Properties tab, then the Data sub-tab.
Note that the page is bound to the Notes form named Form1 in the current database.
- Click on each of the three fields in the table. For example, if you look at Properties/Data, you'll see that each is bound to the matching Notes field from Form1.
- Click on the cell that contains the Submit button – do not click on the button itself. Choose Properties/All Properties below to see the Rendered property. This computed value hides the submit button when the page is opened in read-mode.
- Save and close Form1Page, making sure to save it under an ID that matches the aforementioned security setting.
Next, look at the database with Lotus Notes 8.5.
- Open the database, which contains a single view, one form and a short list of documents.
- Right click on -> Application -> Properties > Launch to examine the launch property of xpages3.nsf. The browser launch is set to use the XPage named LaunchPage.
Run the full sample from a Web browser to see XPages in action.
In your Web browser's address bar, enter: http://nnn.nnn.nnn.nnn/xpages3.nsf, where nnn.nnn.nnn.nnn is the IP address or name of your test Domino server.
Notice that xpages3.nsf opens directly to the launch page that you examined and that it displays a view containing the documents of the database.
You can see that the left-hand column of the view contains clickable links. Clicking one should open the underlying document, using the XPage named Form1Page.
You can modify the data in the document then press Submit.
- After doing so, you may need to use the browser's Back button a couple times to return to the launch page and refresh the page to see the modified data.
ABOUT THE AUTHOR:
Chuck Connell is president of CHC-3 Consulting, which helps organizations with all aspects of Domino and Notes.