2 Replies Latest reply on Feb 12, 2010 4:46 AM by vrelits

    Clearing messages on showing modal dialog

    vrelits

      Hi!

       

      I have a modal dialog with a h:messages tag.

      This problem is that when I have a current page that displays messages, those messages will also be shown in the modal dialog when I open it.

      So I need some way to clear the messages when the dialog opens. Just wanted to know how is the easiest way to do this.

      It is some kind of local messages only for the dialog I'm interested in, but I guess that's not what JSF can handle.

       

      Any ideas?

        • 1. Re: Clearing messages on showing modal dialog
          ilya_shaikovsky

          probably your messages wrapped to outputPanel with ajaxRendered=true. And this is proper definition which required for h:messages to be updated sccesfully. But it makes them to be updated on any requests. So you have next possibilities there:

          • remove this ajaxRendered=true. And define panels which wraps messages in reRender. So you will add only needed id's
          • wrap the main content (without modal panel) to a4j:region with renderRegionOnly=true. So using this way (ifyour page layout allows) It will be still possible to update messages but in the same time nothing outside region will be rendered. But be carefull - if you need to reRender something outside in some case - it will also not be possible.
          • 2. Re: Clearing messages on showing modal dialog
            vrelits

            Would there be a way to clear messages on 'onbeforeload' on dialog. I don't care if it removes messages on main page.

             

            What do you mean by: And define panels which wraps messages in reRender.