Reputation: 5206
If I have this tooltip:
<p:tooltip for="code" hideEffect="fade" showEffect="fade" >
<p:message for="code" />
</p:tooltip>
How can I do to show the tooltip box only if exists an error validation message?
Currently my tooltip looks like this:
Upvotes: 2
Views: 4677
Reputation: 7646
If anyone still needs this. This works with JSF 2.2 PF 5.0
<p:tooltip id="toolTipContent" for="code" trackMouse="true"
rendered="#{not empty facesContext.messageList and not empty facesContext.getMessageList('form:code')}">
<p:message for="code" /> </p:tooltip>
Upvotes: 4
Reputation: 10961
Add a rendered Attribute and check if there is an error-message for this element:
rendered="#{not empty facesContext.getMessageList('code')}"
Upvotes: 0