7 Replies Latest reply on May 30, 2012 5:51 AM by jpapouse

    RF 4: rich:tooltip not working on h:inputText?

    kwutzke

      Hello,

       

      I have the following code:

      {code:xml}

        <h:panelGroup id="tendering-document-panel">

          <h:inputText value="#{tendering.fileName}"

                       disabled="true"

                       readonly="true"

                       id="tendering-filename-input">

            <rich:tooltip value="#{pqManager.tenderingDocumentFileSize} KB" direction="bottomRight" rendered="#{not empty tendering.fileName}" />

          </h:inputText>

          <h:outputText value=" " />

          <ui:include src="/subviews/preview-link.xhtml">

          ...

      {code}

       

      When I put the rich:tooltip outside the inputText but inside the panelGroup the tooltip is shown on hovering the inputText, but it creates ugly artifacts for subsequent components. It's supposed to be displayed only above the inputText.

       

      I tried wrapping the h:inputText into a4j:outputPanel (no attributes), but that didn't work either.

       

      What's wrong? How do you fix this?

       

      Karsten

        • 1. Re: RF 4: rich:tooltip not working on h:inputText?
          jpapouse

          Yes, there is an already reported bug (https://issues.jboss.org/browse/RF-11343). You can use target attribute instead:

           

          <h:inputText id="input"/>
          <rich:tooltip id="tooltip" target="input">
              Tooltip content
          </rich:tooltip>
          
          • 2. Re: RF 4: rich:tooltip not working on h:inputText?
            kwutzke

            It's not working. I had tried this before and all possible combinations of ID, target, and in/outside the inputText - no tooltip displayed. Appears to be a more severe bug. This is really basic stuff in RF not working.

            • 3. Re: RF 4: rich:tooltip not working on h:inputText?
              jpapouse

              Can you provide more information about your environment? Version of RichFaces, container, etc.?

              • 4. Re: RF 4: rich:tooltip not working on h:inputText?
                kwutzke

                I'm using RF 4.2.1.Final, JBoss AS 7.1.1.Final, and Mojarra 2.1.7.

                 

                Karsten

                • 5. Re: RF 4: rich:tooltip not working on h:inputText?
                  jpapouse

                  Oh, I see. I think the problem is you've set @disabled=true in h:inputText.

                   

                  When you set @readonly=true only, it works correctly. Try the following code:

                   

                  <h1>Enabled</h1>
                  <h:form>
                      Type text:
                      <h:inputText id="in" value="#{richTooltipBean.value}">
                          <f:ajax event="keyup" render="out" />
                      </h:inputText>
                      <rich:tooltip id="tooltip" target="in" direction="bottomRight">
                          Tooltip content
                      </rich:tooltip>
                      <br />
                      Output: <h:outputText value="#{richTooltipBean.value}" id="out" />
                  </h:form>
                  <h1>Disabled</h1>
                  <h:form>
                      Type text:
                      <h:inputText id="in2" value="#{richTooltipBean.value2}" disabled="true">
                          <f:ajax event="keyup" render="out2" />
                      </h:inputText>
                      <rich:tooltip id="tooltip" target="in2" direction="bottomRight">
                          Tooltip content
                      </rich:tooltip>
                      <br />
                      Output: <h:outputText value="#{richTooltipBean.value2}" id="out2" />
                  </h:form>
                  <h1>Read Only</h1>
                  <h:form>
                      Type text:
                      <h:inputText id="in3" value="#{richTooltipBean.value3}" readonly="true">
                          <f:ajax event="keyup" render="out3" />
                      </h:inputText>
                      <rich:tooltip id="tooltip" target="in3" direction="bottomRight">
                          Tooltip content
                      </rich:tooltip>
                      <br />
                      Output: <h:outputText value="#{richTooltipBean.value3}" id="out3" />
                  </h:form>
                  

                   

                  My fork of dev-examples containing the code above is available here: https://github.com/papousek/dev-examples/tree/thread-200040 (after deployment, open http://localhost:8080/output-demo-4.2.1.Final/faces/examples/tooltip.xhtml in your browser).

                   

                  I think the rich:tooltip behaves correctly when it isn't active when the input is disabled.

                  1 of 1 people found this helpful
                  • 6. Re: RF 4: rich:tooltip not working on h:inputText?
                    kwutzke

                    Thanks for your help.

                     

                    The problem with my code is that I placed the tooltip as an sub element inside the inputText. Putting them outside seems to be mandatory.

                     

                    The disabled thing you have demonstrated is really true. The next question would be if tooltips should automatically be hidden for disabled elements and/or if there should be a flag on the tooltip to override the behavior on disabled components.

                     

                    Karsten

                    • 7. Re: RF 4: rich:tooltip not working on h:inputText?
                      jpapouse

                      I think the disabling of rich:tooltip on disabled input elements make sense. If you don't think so, create a new feature request on JIRA.