This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Aug 25, 2011, 10:32 PM
21 Posts
topic has been resolvedResolved

Dynamic control generation issue with saving content

  • Category: APIs
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: xpage dynamic controls
  • Replies: 2
Hi there,
 
as you may know from my previous post I'm currently developing a CMS like system. One of the features is to dynamicly create content according to field defintions in the database. These field definitions are documents which tells the back-end what type of field it is (richtext, text, datetime etc. ) where it should be stored and so on. I made some good progress buidling the basic blocks for the system but now I finally reached the hard bits to conquer. 
 
One of these parts is the following.
 
First an example: 
When a user wants to create new content the user opens a page and the backend-end reads the content type from the database. A content type definition defines which fields are used on the document and in what order. A field is a document in the db which defines how the label is called, what the actual field will be on the document and the type of data to store. When the back-end knows about this it creates a java object where this data is stored. For every field definition an java object is created. After all fields are collected a repeat control is used to add dynamicly the correct custom control according to the fields. The result will be a fully operational form. The custom controls are actualy a simple control containing one computed field where we create the html for the field defintion ourselves so we have full control of the generated attributes and so on. When a user fills in the form and presses the 'save' button we tell the current contenttype java object to saveitself with as parameter the requestmap. 
 
The contentype object scans the map for keys that correspond to the field definitions and calls the save method from the field def object with the value from the map and the document (notes doc) to save the data on. The field definition knows how to save the data. The mapping between the requestmap and the fields definitions is done by the field name ( aka keys in the requestmap correspond to fieldnames on the document).
 
Now the problem: 
This works great for default fields such as text, dates ( using the dojo calendtextbox ) but it does not work for richtext items. The reason for this is that I cannot set the id of the richtext control dynamicly. It is defined on page load (only once..) and such it does not work when we define it in a repeat control which includes a dynamic page and passes a content type field object to it. I also experimented with data binding. I tried to bind the richtext control to the current fieldcontext but for some reason this also does not work since it is not available on page load. (because it the custom control where we added the richtext is dynamicly loaded in a repeater? )
 
Is there a way to create the ckeditor myself by only using the computed text control where we use a stringbuffer to generate the HTML? 
 
I know it is a bit complex but when it can work I would like to know :D
Aug 26, 2011, 5:47 AM
129 Posts
Re: Dynamic control generation issue with saving content
It might be possible if you use a separate installation of CKEditor.
 
I wrote about integrating XPages with CKEditor before it was integrated into Domino 8.5.2.  
http://dontpanic82.blogspot.com/2010/03/xpages-full-featured-ckeditor.html 
Aug 29, 2011, 10:19 AM
21 Posts
Re: Dynamic control generation issue with saving content
Hello Tommy,
 
good blogpost! This resolved my issue and saved me tons of research. Really awsome

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal