4 Replies Latest reply on May 14, 2010 4:09 PM by Joey Jarosz

    rich:messages enhancement

    Mike Hanafey Newbie

      rich:messages, unlike h:messages has a "for" attribute, but this does not appear to have any use because it limits the messages displayed to the single named message.

      As an enhancement, rich:messages should instead have a "notfor" attribute. This would take a comma list of id's that would be excluded from display, and the reason would be these id's are covered elsewhere by individual rich:message elements.

      Even better, if feasible, rich:messages would have a "uncoveredOnly" attribute, which if true would mean the element would only display messges linked to ids not covered by rich:message elements in the same view (along with global messages).

      Nearly every view could benefit from a

      <rich:messages uncoverdOnly="true"/>

      element to avoid the frustation of a form submit that silently does nothing.

        • 2. Re: rich:messages enhancement
          Joey Jarosz Newbie

          I'll throw in my two cents here...


          What I would find very useful is that the "for=" attribute could take wildcards, something akin to "MyFom:MyTable:*"


          I have the situation a lot where I have tables containing input fields that have validators. There is never room in the cells for the various error messages, so I would to put them in a place close to the table. The clincher is that I often have multiple tables on a page - and I want to keep the messages for a table close to that specific table (hence catching global messages in a common place not viable).



          • 3. Re: rich:messages enhancement
            Ilya Shaikovsky Master

            I'm not aginst the proposal and agree with Nick's issue risen.. but in general globalOnly attribute could do the work for you. message pointed to component with for - will show concrete components messages and rich:messages with globalOnly set will show the global ones.

            • 4. Re: rich:messages enhancement
              Joey Jarosz Newbie

              Hi Ilya,


              Hopefully the image below (I also attached the image file in case) clarifies what my needs are and why the current "for=" functionality is insufficient. The image is hacked up from a page that shows more input fields, but I had to hide some information that was propierty to our customer.


              You can see I have several tables on the page, each one contains multiple input fields, any of which could cause validation errors. The only two options now is to use rich:messages with globalOnly=true or rich:messages with for=somecomponent. Neither of these is sufficient because globalOnly=true would cause the messages to be show above all the tables, and for= does not work because I can point at coding time to the complete list of input field IDs since the data is dynamically populated.


              That is why I think expanded for= to accept wildcards, or at least parent component specifiers are necessary. So I can have:

                   rich:messages for="SoftIPTable:*"

                   rich:messages for="HardIPTable:*"

                   rich:messages for="ERAMTable:*"


              to localize the destination of messages originating from fields in each of the individual tables.


              Keep in mind, I am far from being an expert with JSF or RichFaces.