PermaLink XPages Example part 2: Generating dynamic editable fields for a document collection06/16/2008 03:50 AM
Domino 8.5 - XPages
* please note: This example has been updated to work with 8.5 Gold.

I built on the previous XPage example, the Customer Orders application, to demonstrate how to generate dynamic fields from a document collection.  There is a sample database for you to download as well as a powerpoint presentation that explains the steps involved.

Over the years I have developed different techniques to handle dynamic fields in Domino applications.  I'm sure many of you have also tackled this issue in various ways.  In XPages there are built in controls that you can utilize to address this issue.

In the previous example I demonstrated how XPages allows you to bind your controls on the page to multiple datasources.  In this example I take it up a notch by showing how you can repeat a panel control that is bound to a document multiple times, thereby binding edit controls to a collection of Notes documents.  XPages maintains the binding so that all the documents are updated from a single button with a single simple action "Save Datasources".

Here's the use case: When a Customer Order is created there could be multiple items the customer is ordering.  We should give the user the ability to add new items dynamically by clicking a button.  The button will create a new response document and then reload the page.  The repeat control will generate the following editable fields for all the response documents: Item Number, Price, and Quantity.

Here is a screen shot:
Image:John's Blog - XPages Example part 2: Generating dynamic editable fields for a document collection

Here are the downloads:
- CustomerOrders.nsf
- step-by-step powerpoint

Download the application and try it out.  Contact me if you have any questions via posting or email.  My contact information is in the powerpoint.

John

Technorati:
This page has been accessed 2428 times. .
Comments :v

1. Vidyasagar07/18/2008 01:43:34 AM


Nice one. Its working fine. But is there a way to add an X page in the repeat control and get the same functionality?




2. John Mackey07/18/2008 04:35:50 AM


Vidyasagar, you can add a custom control in a repeat control. A custom control is basically an XPage itself, similar to a subform in Domino.

The multi-file upload sample is an example of this. Take a look at this post: { Link }




3. veena12/15/2008 07:23:28 PM


Thanks for your good example and step by step ppt, I have problem while running the "CustomerOrders.nsf " on my own server, the error message in browser is: "Error 500
HTTP Web Server: Command Not Handled Exception", and the error message on server console is: "HTTP JVM: SEVERE: CLFAD####E: Exception thrown". what's wrong?




4. hector amato02/03/2009 04:19:02 AM


After having a look at the HTNL generated, I see that there is a DIV element the corresponds to the Repeat Control. i would need to use an outer table instead of an inner one, and then repeat only the rows. The problem is that the HTML comes as
<TABLE>
<DIV id="... (repeat)
<TR>...
<TR>...
....
</TABLE.
so it is not well formed.

Is there any way to remove the DIV from the output HTML ?. I have seem that the repeat has a property removerepeat that should do the job, but it dows not work. Any hints ?




5. John Mackey02/03/2009 11:49:18 AM


@Hector, Yes I completely understand your issue with using an inner table. You might want to look at using the "Data Table" control instead of a repeat control. It seems to be in between a view control and a repeat control. Here's a link to the wiki where there is a great demo by Paul Hannan from IBM.

{ Link }

Also, there is an additional entry explaining how to remove the HTML tags completely: { Link }

Regards,
John




Search
Hire the Experts
Need help on your XPages projects?

Talk to the experts! Read more...
XPage Examples
By Category
My Links
Downloads
Monthly Archive
Powered by
Blogsphere
Lotus Domino ND7 RSS News Feed RSS Comments Feed Geo URL netcraft RSS Validator Lotus Geek Chris. A. Brandlehner OpenNTF BlogSphere