dominoGuru.com

Your Development & Design Resource

General Form Development with XPages

General Form 
Development with XPages If you're writing an XPages version of an existing Lotus Notes Client application... well, the application structure is already defined for you. But one of my earlier frustrations with developing XPage applications is the need to create a Form and View to house the would-be data structure of a NotesDatabase.

I always felt this flew in the face of the idea of complete separation of UI and data... but as most Notes Developers (sad to say) do not understand the fundamental differences between a Form Design Element and a NotesDocument, I totally understand the need to go lowest common denominator (yikes, that makes me sound like a jerk...) with the whole thing.

Thing is... you don't have to create a Field on a Form Design Element and bind that Field to an XPage control to create a NotesItem in the target NotesDocument.

XPage DataSource for document1 with no fields. XPage DataSource for document1 with no fields.

See, the value for the Bind to for the XPage Data Source can be entered manually.

XPage DataSource for document1 with manually-entered field. XPage DataSource for document1 with manually-entered field.

After all, it's simply writing markup to the XPage, and there's no difference between entering the Data Source for a given XPage control via the Properties panel or directly in the XPage markup via the Source pane.

Both result in the following example XPage markup:

<xp:inputText id="inputText1" value="#{document1.field1}" />

The beauty here is that the field does not have to exist on the target Form. Hell, the Form Design Element doesn't even need to exist in the target NotesDatabase!

Consider this simple XPage (source here):

document.xsp XPage document.xsp XPage

This XPage can be used to read/write a NotesDocument that sets the following NotesItem values:

NotesItemSet From...
field1"inputText1" inputText control
field2"inputText2" inputText control
field3"inputText3" inputText control
formXPage's dominoDocument Data Source
type"inputType" radioGroup control
$UpdatedByProgrammatically added by Domino

The results are simple NotesDocuments maintained by XPages without a correlating Form Design Element. Yep, there's no "document" Form, and there's no need for a "document" Form either.

Using this technique, you can easily create new NotesItems (or even new types of documents) as needed without the worry of maintaining two design elements (i.e., the XPage and a Data Source-driving Form).

And while the XPage Properties panels are wired for the more traditional usage scenario (read: they'll start whining in the editor that you're being too l33t -- see below), don't let that stop you!

'No data available!' in XPage 
Data Source Properties panel 'No data available!' in XPage Data Source Properties panel

Yet again, XPages give you complete control over the NotesDatabase and the NotesData stored within. And while there are certainly cases where a Traditional Design Element-based application is needed (e.g., Lotus Notes Client applications, especially those that interact with other applications installed on the OS or the OS itself...), I'm finding it more and more difficult to go backwards when I hit Ctrl+N.


About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of dominoGuru.com, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.



More from dominoGuru.com


dominoGuru.com is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, dominoGuru.com by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.