0

I have set a messageDetailNotInRange message inside tr:validateDateTimeRange for my tr:inputDate component. It appears just below the component. It there a way to make it appear (and replace) the default message (that is being added to the FacesContext) that appears for at the top of the page?

Note: Alternate solutions to change this error message have not worked. I can only conclude that it is being thrown up on the server-side. I do not have access to the trinidad message bundle (it must be living on the server side). It also seems that server-side validation is happening before I can intercept the message or the date value (stored not in a bean, but in processScope), which presents a big challenge in customizing my error message.

cmac
  • 906
  • 10
  • 19
  • 1
    You don't need access to Trinidad's message bundle (it's embedded in one of it's classes), you can just use (or add) your own message bundle and use that in JSF (faces-config.xml > application > message-bundle). Once you have a message bundle you can override Trindad's messages using the correct key (see http://stackoverflow.com/a/15122278/880619) – Jasper de Vries Mar 21 '13 at 14:58
  • This is clear now. Yes, this is what was suggested in that referenced thread (mine) Great solution. – cmac Mar 22 '13 at 19:17

1 Answers1

0

Just have <tr:messages/> at the top of your page and you're done.

The messages bean is used at the top of an application page to give the user important messaging information. It will automatically show any messages added to the FacesContext.

You can skin them using the selector af|messages (search documentation for 'tr:messages Component')

This tr:messages component is implemented using an inner div nested within an outer table. The outer container is used to lay out the messages' icons. The inner container contains the actual contents of the messages. If any transparent icons are used, style properties such as the background color should probably be set on the inner table via the af|messages::body selector.

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
  • I should have mentioned this up top, but I already have a at the top of my page. When I set MessageDetailNotInRange on my component, the new message shows below the component. But in the panel, the default message shows. I want to replace the default message with the MessageDetailNotInRange message. Sorry for the confusion – cmac Mar 08 '13 at 15:38