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



Sep 12, 2012, 12:45 AM
4 Posts

Rich Text Control (that was updated) Not Submitting to Server

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 5
I have an XPage with a Rich Text control that I bind to requestScope.Body. If I modify the content in my Rich Text control, the changes are submitted and saved to the document.
 
Problem:
The XPage also has a Combo Box control that lets me choose from a list of documents that are displayed in a view from my database. Each document has a Rich Text field that contains some pre-formatted content. As I select a document from my Combo Box control, the content being displayed in my Rich Text control is updated with the content from the document that I selected.
 
The updating of content in my Rich Text control works great BUT when I do this and submit my XPage, the changes aren't sent to the server. It's as if my XPage doesn't know that the content in the Rich Text control has changed (isModified not being set?). What's really strange is that after updating the content with my Combo Box selection, I can then click into the Rich Text control and manually type in additional content. If I do this and submit my XPage, it appears that isModified is set properly
 
(i.e. I receive the following prompt: "Saving this document will change its format from native Notes rich text to HTML. This may cause a change or loss of formatting if opened again in the regular Notes client")
 
BUT... rather than submitting what is currently in my Rich Text control, the initial value of requestScope.Body gets submitted. Frustrating!!! Any help would be greatly appreciated.
 
XPages Newbie
Sep 12, 2012, 5:31 AM
129 Posts
Re: Rich Text Control (that was updated) Not Submitting to Server
I had another issue with RT a while back (validation+custom partial refresh resulted in losing content). Maybe my workaround can work for you as well.
  
Try to put this in onComplete of the refresh that updates the RT field:
// Process any autogenerated submit listeners
if( XSP._processListeners ){ // Not sure if this is valid in all versions of XPages
XSP._processListeners( XSP.querySubmitListeners, document.forms[0].id );
}
 
The blogpost: 
http://dontpanic82.blogspot.no/2011/02/xpages-richtexteditor-custom-partial.html 
 
If you haven't used onComplete yet, this shows you where to find it: 
http://www.domino-weblog.nl/weblogs/domino_blog.nsf/dx/location-of-new-events-in-xpages.htm 
 
Let me know if it works :) 
Sep 12, 2012, 2:12 PM
4 Posts
Re: Rich Text Control (that was updated) Not Submitting to Server
Unfortunately that didn't work for me. I think my issue is that the isModified() function is returning false to the field named <yourRTField>_mod, so my submit isn't sending the updated content in my Rich Text control back to the server. I think I need to figure out how to trigger isModified and return true via SSJS. Thanks for your help though! I'll keep digging!
Sep 12, 2012, 4:51 PM
4 Posts
Re: Rich Text Control (that was updated) Not Submitting to Server
Slight turn of events here... Originally I had bound my Rich Text control to requestScope.Body because the example I found was doing it that way. Even if I don't dynamically update my Rich Text control contents, any manual changes to the Rich Text control are lost since that control isn't bound to the Rich Text field of the document. The good new is I went back to simple data binding using document1.CommuincationBody ("CommunicationBody" is the name of my Rich Text field). I can still dynamically update the contents of the Rich Text control by changing the selection in my Combo Box control. Now I have a different problem. When I submit my XPage I get an error: Cannot convert item to requested datatype (see stack trace below).
 
 In my Combo Box I do the following (onchange event):
  1. Use the selected value to get a handle to a document in my database.
  2. From the document I create a NotesMIMEEntity using the "Body" field of the document (Rich Text field).
  3. I then get a string variable of the contents from the document using var strBody:String = entity.getContentAsText().
  4. Lastly I change the contents in my Rich Text control using: getComponent("communicationBody1").setValue(strBody).
 

Exception

Error while saving document
Could not save the document C7A NotesException: Cannot convert item to requested datatype

Stack Trace

javax.faces.FacesException: Error while saving document
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:102)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96)
    com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:250)
    com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:206)
    com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:193)
    com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:154)
    com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:137)
    com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:86)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:538)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1151)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:803)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:758)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:527)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1135)
    com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:523)
    com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:352)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:304)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:261)
    com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:291)
com.ibm.xsp.exception.EvaluationExceptionEx: Error while saving document
    com.ibm.xsp.actions.SaveDocumentAction.invoke(SaveDocumentAction.java:56)
    com.ibm.xsp.application.ActionListenerImpl.processAction(ActionListenerImpl.java:60)
    javax.faces.component.UICommand.broadcast(UICommand.java:324)
    com.ibm.xsp.component.UIEventHandler.broadcast(UIEventHandler.java:365)
    com.ibm.xsp.component.UIViewRootEx.broadcast(UIViewRootEx.java:1505)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:307)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:428)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:94)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96)
    com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:250)
    com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:206)
    com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:193)
    com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:154)
    com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:137)
    com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:86)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:538)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1151)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:803)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:758)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:527)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1135)
    com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:523)
    com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:352)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:304)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:261)
    com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:291)
com.ibm.xsp.FacesExceptionEx: Could not save the document C7A NotesException: Cannot convert item to requested datatype
    com.ibm.xsp.model.domino.DominoDocumentData.doSaveDocument(DominoDocumentData.java:482)
    com.ibm.xsp.model.AbstractDocumentDataSource.save(AbstractDocumentDataSource.java:76)
    com.ibm.xsp.model.AbstractDataSource._saveData(AbstractDataSource.java:528)
    com.ibm.xsp.model.AbstractDataSource.save(AbstractDataSource.java:509)
    com.ibm.xsp.actions.SaveDocumentAction.invoke(SaveDocumentAction.java:49)
    com.ibm.xsp.application.ActionListenerImpl.processAction(ActionListenerImpl.java:60)
    javax.faces.component.UICommand.broadcast(UICommand.java:324)
    com.ibm.xsp.component.UIEventHandler.broadcast(UIEventHandler.java:365)
    com.ibm.xsp.component.UIViewRootEx.broadcast(UIViewRootEx.java:1505)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:307)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:428)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:94)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96)
    com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:250)
    com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:206)
    com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:193)
    com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:154)
    com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:137)
    com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:86)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:538)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1151)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:803)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:758)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:527)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1135)
    com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:523)
    com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:352)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:304)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:261)
    com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:291)
NotesException: Cannot convert item to requested datatype
    lotus.domino.local.Document.replaceItemValue(Unknown Source)
    com.ibm.xsp.model.domino.wrapped.DominoDocument.applyChangesToDoc(DominoDocument.java:1363)
    com.ibm.xsp.model.domino.wrapped.DominoDocument.applyChanges(DominoDocument.java:1319)
    com.ibm.xsp.model.domino.wrapped.DominoDocument.save(DominoDocument.java:843)
    com.ibm.xsp.model.domino.DominoDocumentData.doSaveDocument(DominoDocumentData.java:478)
    com.ibm.xsp.model.AbstractDocumentDataSource.save(AbstractDocumentDataSource.java:76)
    com.ibm.xsp.model.AbstractDataSource._saveData(AbstractDataSource.java:528)
    com.ibm.xsp.model.AbstractDataSource.save(AbstractDataSource.java:509)
    com.ibm.xsp.actions.SaveDocumentAction.invoke(SaveDocumentAction.java:49)
    com.ibm.xsp.application.ActionListenerImpl.processAction(ActionListenerImpl.java:60)
    javax.faces.component.UICommand.broadcast(UICommand.java:324)
    com.ibm.xsp.component.UIEventHandler.broadcast(UIEventHandler.java:365)
    com.ibm.xsp.component.UIViewRootEx.broadcast(UIViewRootEx.java:1505)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:307)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:428)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:94)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96)
    com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:250)
    com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:206)
    com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:193)
    com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:154)
    com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:137)
    com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:86)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:538)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1151)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:803)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:758)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:527)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1135)
    com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:523)
    com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:352)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:304)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:261)
    com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:291)
 
Sep 13, 2012, 6:01 AM
129 Posts
Re: Rich Text Control (that was updated) Not Submitting to Server
When you create the NotesMimeEntity, do you do session.setConvertMime( false ) before the creation? This to prevent conversion from Mime to RT.
 
I haven't worked much with RT-fields in XPages lately, but I think the XPages RT editor uses/expects a MimeEntity.
Sep 13, 2012, 11:15 PM
4 Posts
Re: Rich Text Control (that was updated) Not Submitting to Server
Yep, tried it with and w/o but no changes.

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