• Post Reply Bookmark Topic Watch Topic
  • New Topic

button inside a h;messages

 
camilla bat
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am displaying global errors using h:messages. This works perfectly fine. I have made a javascript so that the error message goes away when the user clicks somewhere.

What I really want is to have a button inside the message pane. In this way the user could click the button and then make the message go away.
However, I don't know if its possible to show the button with the error (only when the error is displayed!!).
I put the button inside the message tag like this:
<h:messages infoClass="errorStyle" ..>
<h:commandButton ../>
</h:messages>

But this seems to display the button all the time, even when there's no message to display.

Does anybody know if it's possible to put other components together with the message tag??

Thanks for any help.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using the rendered attribute in the h:commandButton or h:message. The valuebinding in the rendered attribute should return true if there is any error and/or message.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!