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



May 9, 2011, 10:46 PM
57 Posts

Re: how to trigger onError from a server side event?

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role:
  • Tags:
  • Replies: 6
add FacesMessage to FacesContext, either for the entire page with
 
if (doc.isInConflictMode()){
    FacesMessage m2 = new FacesMessage("doc is edited by someone else");
    FacesContext.getCurrentInstance().addMessage(null, m2);
 }
 
or to individual UIComponent
if (doc.isInConflictMode()){
   UIComponent com = JSFUtil.findComponent("inputText1");
   FacesMessage m2 = new FacesMessage("doc is edited by someone else");
   FacesContext.getCurrentInstance().addMessage(
                com.getClientId(FacesContext.getCurrentInstance()), m2);
}
put "display error" or "display errors" control on designer, then it will display those error messages. 
 

May 10, 2011, 6:58 PM
47 Posts
Re: how to trigger onError from a server side event?
 Unfortunately this does not cause the onError() call back to be executed, onStart executes correctly before the post to the server, and then onComplete executes once the response is received. BTW, there is a helper function @ErrorMessage that encapsulates much of the work related to the facesContext.addMessage stuff.
 
I was able to get the error message to show in an xp:messages control, if it was within the context being refreshed (this action only does a partial refresh). Ideally I would have a single error control that displays a dialog when there is something to report, and I could cascade the partial refresh in my onError callback.
 
Rich 
 

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