Tuesday, October 19, 2010

Binding Richtext Fields and File Upload Controls in XPages

The following is a simple POC that describes how file upload controls on XPages work when bound to Rich text fields in Notes Forms.

Create a Simple form with 2 Rich Text fields and bind them to two file upload controls respectively on a Xpage as shown in the following figure and save them.

Now Preview the XPage, add a couple of attachments and Save the XPage

The code that I used in the upload button here is - currXPDoc.save() where currXPDoc is my datasource's name

Thus a document gets saved in the back end. Opening the same will help you find the attachments embedded into their respective richtext fields as follows,

Hope this helps :)