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

    Javascript alert in messages area - rich:messages

    Leonardo Cardoso Newbie

      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 name="errorMarker">
       <h:graphicImage value="images/icones/erro.gif" />

      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>

      Is there a better way to do that?

      Thanks in advance