This content has been marked as final.
Show 1 reply
-
1. Re: rich:messages or h:messages and javascript call
mwohlf Apr 22, 2009 6:14 PM (in response to chrisbarton126)Hi Chris,
that's on my feature list too and i just hacked something together, here is what I got so far:
<a4j:outputPanel id="msgs" ajaxRendered="true"> <script type="text/javascript"> jQuery(document).ready(function() { // change the message properties jQuery('#msgs .messages').css({ position: "absolute", top: 0, left: 0, border: 0, padding: 0, margin: 0, width: "100%", background: "#ffff00" }).show(); // hide message after timeout window.setTimeout(function() { jQuery('#msgs .messages').hide(); }, 5000); }); </script> <h:messages layout="list" styleClass="messages" style="display: none;" infoClass="info" warnClass="warn" errorClass="error" fatalClass="fatal" escape="false"> </h:messages> </a4j:outputPanel>
I use the jQuery(document).ready() function to change the message's css styles, for ajax requests I rerender the whole msgs panel including the javascript part, at least on FF this seems to trigger the jQuery call, haven't tested on other browsers and it seems like a bit of an overkill to me now, hopefully you can do some improvements ;-)