1 Reply Latest reply on Dec 19, 2008 7:03 AM by angeldstu

    how to call modal panel from managed bean

    jaabax

      hi
      there is a way to call a modal from a managedbean?
      i have seen some examples like this

      //Class FacesHelper
       public static void addFatalMessage(String summary, String detail)
       {
       FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_FATAL, summary, detail));
       }
      


      and inside managed bean I call it this way

      FacesHelper.addFatalMessage("Smmay","Msg");
      



      but when i call it, i received a "faces enqueued but maybe not displayed"
      how to implement it
      any tip?



        • 1. Re: how to call modal panel from managed bean
          angeldstu

          You can use "oncomplete" event of a a4j components (like a4j:commandLink) to call Model Panel after doing something instead of your solution.

          <a4j:commandButton value="button€"
          oncomplete="javascript:Richfaces.showModalPanel('CustomPanel')"
          action="#{someBean.someMethod}"
          reRender="CustomPanel"/>
          


          public class SomeBean
          {
           private String fatalErrMsg = new String("Fatal Error!");
          
           public String getFatalErrMsg()
           {
           return fatalErrMsg;
           }
           public void someMethod()
           {
           //doing something with fatalErrMsg
           }
          }
          


          <rich:modalPanel>
           <h:outputText value="#{someBean.fatalErrMsg}"/>
          </rich:modalPanel>