2 Replies Latest reply on Jul 20, 2011 2:13 PM by robertgary1

    RF 3 - rich:messages decorations?

    robertgary1

      Is it possible to provide a border around rich:messagse if messages are available? I would like the border to be around all the messages.

       

      -Robert

        • 1. Re: RF 3 - rich:messages decorations?
          richyclarke

          Hi,

           

          facesContext.maximumSeverity can be used to determine if any messages are present.

           

          You could try rendering a panel with a border using rendered="#{facesContext.maximumSeverity ne null}".

           

          Alternatively check (facesContext.maximumSeverity==null) in a backing bean and set a styleClass property to a named CSS style. Then use styleClass="#{bean.getStyleClass}" on your page.

           

          Haven't tried it but should work.

          Rich

          • 2. Re: RF 3 - rich:messages decorations?
            robertgary1

            Richard,

            The only issue with that is that it requires a trip to the backing bean. I'm using clientside and server side validations. However, I think I've found a clientside solution.

             

            .simpleSection {

                 border-style: solid;

                 border-width: thin;

                 border-color: gray;

            }

                    <rich:messages styleClass="simpleSection" style="width:70%;border-spacing:5px;"
                                   errorClass="errorText" ajaxRendered="true" showSummary="false" showDetail="true"
                            layout="table" id="messages">
                        <f:facet name="errorMarker">
                            <h:graphicImage url="/images/Status_red.gif"/>
                        </f:facet>
                        <f:facet name="infoMarker">
                            <h:graphicImage url="/images/Status_green.gif"/>
                        </f:facet>
                    </rich:messages>

             

            The border is then only rendered when there is a message.

             

            -Robert