Baseline
We want to display information overview of a h:commandButton. This information is different if the button is disabled or not.
Problem
If the h:commandButton is disabled, the rich:toolTip doesn’t appear.
<h:commandButton id="myButton" value="Action" action="#{myBean.myFunction()}" disabled="#{myBean.myVariable}" > <rich:toolTip for="myButton" followMouse="true" styleClass="tooltip" showDelay="300" > <h:outputText value="my message if the button is not disabled" rendered="#{myBean.myVariable==false}"/> <h:outputText value="my message if the button is not disabled" rendered="#{myBean.myVariable==true}"/> </rich:toolTip> </h:commandButton>
Solution
<a4j:outputPanel> <h:panelGrid columns="1"> <h:commandButton id="myButton" onmouseover="#{rich:component('infoBtn')}.show()" onmouseout="#{rich:component('infoBtn')}.hide()" value="Action" disabled="#{myBean.myVariable}" action="#{myBean.myFunction()}" /> </h:panelGrid> <rich:toolTip id="infoBtn" > <h:outputText value="my message if the button is not disabled" rendered="#{myBean.myVariable==false}"/> <h:outputText value="my message if the button is not disabled" rendered="#{myBean.myVariable==true}"/> </rich:toolTip> </a4j:outputPanel>