0 Replies Latest reply on Oct 10, 2007 3:33 PM by leonardocardoso

    Javascript alert in messages area - rich:messages

    leonardocardoso

      Hi all,

      In my JSF application, when I show messages using, for example, "rich:messages", I want to show a javascript "alert" with the same content.

      I've read the docs and didn't find any component to do that.

      By now, I'm using the "rich:messages" component and an outputPanel to do the trick.

      This code show the messages normally.

      <rich:messages id="list" layout="list" keepTransient="false">
       <f:facet name="infoMarker">
       <h:graphicImage value="images/icones/info.gif" />
       </f:facet>
       <f:facet name="errorMarker">
       <h:graphicImage value="images/icones/erro.gif" />
       </f:facet>
      </rich:messages>


      This code call a javascript function that read the content of the list and show the alert.
      <a4j:outputPanel ajaxRendered="true" keepTransient="false">
       <f:verbatim><script type="text/javascript">javascript:showAlertErrorMessagesInListRichFaces('formGeral:list');</script></f:verbatim>
      </a4j:outputPanel>


      Is there a better way to do that?

      Thanks in advance
      Leonardo