7 Replies Latest reply on Apr 5, 2011 4:36 AM by Ilya Shaikovsky

    rich:message inside a rich:tooltip?

    Nikhil Patil Newbie

      Hi! I'm using Richfaces CR1 + Mojarra 2.0.4

      I was trying my hands on JSR-303 validators. It works great!

      I was trying to show the validation messages inside a tooltip. Is it possible to do so? I tried the following

       

      <h:inputText id="uname" value="#{userBean.fname}">
           <rich:validator/>
              <rich:tooltip layout="block">
                  <rich:message styleClass="innerTooltip"/>
              </rich:tooltip>
      </h:inputText>
      
      

       

      This doesn't render a tooltip (can't find a rf-tt class in firebug) in the page. Am I using it correctly? Tested with Richfaces 4 Final jars as well

       

      EDIT: I couldn't get even the following to work

       

      <h:inputText id="uname" value="#{userBean.fname}">
              <rich:tooltip layout="block" value="Enter fname here"/>
      </h:inputText>
      
        • 1. rich:message inside a rich:tooltip?
          iabughosh Master

          Hi patil,

          try this :

          <rich:message for="t1" showDetail="false" showSummary="false">

                                                  <f:facet name="errorMarker">

              <h:graphicImage id="msgImg" url="/web/error.jpg"/>

                                                  </f:facet>

          </rich:message>

          <rich:toolTip layout="block" for="msgImg">

             <rich:message for="t1" id="msg2"></rich:message>

          </rich:toolTip>

          • 2. rich:message inside a rich:tooltip?
            Nikhil Patil Newbie

            Thanks Ibrahim!

            I tried it and it didn't show anything . However, if i move the rich:tooltip outside of the containing panel (but inside parent form) with attached="false", it does render. But the tooltip is displayed on mousover of form itself so it seems like it ingnores the attached property.

            Secondly, throughtout the examples and even in your code, you've used rich:toolTip. I am able to use rich:tooltip only (with a small T). If I try to use the cap T, I get an error

             

            <rich:toolTip> Tag Library supports namespace: http://richfaces.org/rich, but no tag was defined for name: toolTip

             

            What could be the issue?

            • 3. rich:message inside a rich:tooltip?
              iabughosh Master

              ok, try moving the toolTip inside the message itself like this :

              <rich:message for="t1" showDetail="false" showSummary="false">

                                                      <f:facet name="errorMarker">

                  <h:graphicImage id="msgImg" url="/web/error.jpg"/>

                                                      </f:facet>

              <rich:toolTip layout="block" for="msgImg">

                 <rich:message for="t1" id="msg2"></rich:message>

              </rich:toolTip>

               

              </rich:message>

               

              it should appears only when the mouse overs the image,

               

              my previous sanpshot is with RichRaces version 3.3.2, maybe RichFaces 4 use it with small (T).

              • 4. Re: rich:message inside a rich:tooltip?
                Nikhil Patil Newbie

                No luck with that either!

                 

                As I said earlier, I'm not able to render a simple tooltip on a inputText component either! May be that is the root reason?

                And about the small/caps (T),you must be right but its a bit conufsing. In the component reference itself both the T's are used interchangeably.

                 

                I could get a simple tooltip working only on a h:commandButton and a4j:commandLink. It didn't work with a4j:commandButton or h:inputText.

                • 5. Re: rich:message inside a rich:tooltip?
                  Ilya Shaikovsky Master

                  <h:inputText value="#{validationBean.name}" id="name">

                                                                    <rich:validator />

                                                          </h:inputText>

                                                                    <rich:tooltip target="name">

                                                                              <rich:message for="name" />

                                                                    </rich:tooltip>

                   

                  that still requires some work (prevent show if there are no errors for example). But anyway - working for me.

                   

                  and not works with nested tooltip because JSF 2 has next code in input renderer

                          boolean renderChildren = WebConfiguration.getInstance()

                                  .isOptionEnabled(WebConfiguration.BooleanWebContextInitParameter.AllowTextChildren);

                   

                   

                          if (!renderChildren) {

                              return;

                          }

                   

                  and WebConfiguration.BooleanWebContextInitParameter.AllowTextChildren - false by default in JSF 2. So it encodes only behaviors.

                  • 6. Re: rich:message inside a rich:tooltip?
                    Nikhil Patil Newbie

                    Thanks Ilya! that works fine OK.Good to know the reason why it doens't work in nested mode.

                    In the documentation, there's no mention of the 'target' attribute. It still speaks of 'for'. Shouldn't that be corrected? Its misleading.

                    • 7. Re: rich:message inside a rich:tooltip?
                      Ilya Shaikovsky Master

                      yup.. I performing review of all thhe documentation right now. https://issues.jboss.org/browse/RFPL-1380?focusedCommentId=12593492#comment-12593492 Part 4 of the review contains that.. But many thanks and keep us updated if will have any problems like that - it's really helpfull to help fresh community look!